Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 208d626100
commit f74c547a13
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using UnityEngine;
using System.Collections;
namespace Com.LuisPedroFonseca.ProCamera2D.TopDownShooter
{
public class PlayerFire : MonoBehaviour
{
public Pool BulletPool;
public Transform WeaponTip;
public float FireRate = .3f;
public float FireShakeForce = .2f;
public float FireShakeDuration = .05f;
Transform _transform;
void Awake()
{
_transform = transform;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
{
StartCoroutine(Fire());
}
}
IEnumerator Fire()
{
while (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0))
{
var bullet = BulletPool.nextThing;
bullet.transform.position = WeaponTip.position;
bullet.transform.rotation = _transform.rotation;
var angle = _transform.rotation.eulerAngles.y - 90;
var radians = angle * Mathf.Deg2Rad;
var vForce = new Vector2((float)Mathf.Sin(radians), (float)Mathf.Cos(radians)) * FireShakeForce;
ProCamera2DShake.Instance.ApplyShakesTimed(new Vector2[]{ vForce }, new Vector3[]{Vector3.zero}, new float[]{ FireShakeDuration });
yield return new WaitForSeconds(FireRate);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c8b08415e633a4d27a4a801090003559
timeCreated: 1443634967
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using UnityEngine;
using System.Collections;
namespace Com.LuisPedroFonseca.ProCamera2D.TopDownShooter
{
public class PlayerHealth : MonoBehaviour
{
public int Health = 100;
Renderer[] _renderers;
Color _originalColor;
void Awake()
{
_renderers = GetComponentsInChildren<Renderer>();
_originalColor = _renderers[0].material.color;
}
void Hit(int damage)
{
Health -= damage;
StartCoroutine(HitAnim());
if (Health <= 0)
{
// Do something here
}
}
IEnumerator HitAnim()
{
ProCamera2DShake.Instance.Shake("PlayerHit");
for (int i = 0; i < _renderers.Length; i++)
{
_renderers[i].material.color = Color.white;
}
yield return new WaitForSeconds(.05f);
for (int i = 0; i < _renderers.Length; i++)
{
_renderers[i].material.color = _originalColor;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a91f77722c3ad48e3b7f7c3dbe368d59
timeCreated: 1444245033
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
using UnityEngine;
namespace Com.LuisPedroFonseca.ProCamera2D.TopDownShooter
{
[RequireComponent(typeof(CharacterController))]
public class PlayerInput : MonoBehaviour
{
public float RunSpeed = 12;
public float Acceleration = 30;
float _currentSpeedH;
float _currentSpeedV;
Vector3 _amountToMove;
int _totalJumps;
CharacterController _characterController;
bool _movementAllowed = true;
void Start()
{
_characterController = GetComponent<CharacterController>();
var cinematics = FindObjectsOfType<ProCamera2DCinematics>();
for (int i = 0; i < cinematics.Length; i++)
{
cinematics[i].OnCinematicStarted.AddListener(() =>
{
_movementAllowed = false;
_currentSpeedH = 0;
_currentSpeedV = 0;
});
cinematics[i].OnCinematicFinished.AddListener(() =>
{
_movementAllowed = true;
});
}
}
void Update()
{
if (!_movementAllowed)
return;
var targetSpeedH = Input.GetAxis("Horizontal") * RunSpeed;
_currentSpeedH = IncrementTowards(_currentSpeedH, targetSpeedH, Acceleration);
var targetSpeedV = Input.GetAxis("Vertical") * RunSpeed;
_currentSpeedV = IncrementTowards(_currentSpeedV, targetSpeedV, Acceleration);
_amountToMove.x = _currentSpeedH;
_amountToMove.z = _currentSpeedV;
_characterController.Move(_amountToMove * Time.deltaTime);
}
// Increase n towards target by speed
private float IncrementTowards(float n, float target, float a)
{
if (n == target)
{
return n;
}
else
{
float dir = Mathf.Sign(target - n);
n += a * Time.deltaTime * dir;
return (dir == Mathf.Sign(target - n)) ? n : target;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b4ec74b66098a4f9eb5b9370cb16ebf6
timeCreated: 1443612819
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: