Browse Source

no speed boost from birds but speed boost from shooting

master
Josh 2 years ago
parent
commit
d39a288eed
  1. 11
      unity/Assets/Scripts/DragonMovement.cs

11
unity/Assets/Scripts/DragonMovement.cs

@ -5,6 +5,7 @@ using UnityEngine;
public class DragonMovement : MonoBehaviour public class DragonMovement : MonoBehaviour
{ {
const bool ROTATE_WITH_FLAP = false; const bool ROTATE_WITH_FLAP = false;
const bool LEAN_WITH_SHOOT = true;
[SerializeField] KeyCode FlapKey; [SerializeField] KeyCode FlapKey;
Rigidbody2D _rigidbody; Rigidbody2D _rigidbody;
@ -85,7 +86,7 @@ public class DragonMovement : MonoBehaviour
Bird bird = collision.GetComponent<Bird>(); Bird bird = collision.GetComponent<Bird>();
bird.Eat(); bird.Eat();
Ammo = 5; Ammo = 5;
_speedBoostTime = 1f; //_speedBoostTime = 1f;
_attackType = bird.AttackType; _attackType = bird.AttackType;
if (_attackType == AttackType.FIREBALL) if (_attackType == AttackType.FIREBALL)
@ -229,6 +230,8 @@ public class DragonMovement : MonoBehaviour
if (Ammo <= 0) if (Ammo <= 0)
return; return;
_speedBoostTime = .25f;
Ammo--; Ammo--;
if (_attackType == AttackType.FIREBALL) if (_attackType == AttackType.FIREBALL)
@ -265,6 +268,10 @@ public class DragonMovement : MonoBehaviour
{ {
transform.eulerAngles = new Vector3(0f, 0f, 30f); transform.eulerAngles = new Vector3(0f, 0f, 30f);
} }
else if (_speedBoostTime > 0 && LEAN_WITH_SHOOT)
{
transform.eulerAngles = new Vector3(0f, 0f, -15f);
}
else else
{ {
transform.rotation = Quaternion.identity; transform.rotation = Quaternion.identity;
@ -325,7 +332,7 @@ public class DragonMovement : MonoBehaviour
if (_speedBoostTime > 0f) if (_speedBoostTime > 0f)
{ {
horizontalSpeed *= 2.3333f; horizontalSpeed *= 2.3333f *3f;
} }
_debugCurSpeed = horizontalSpeed; _debugCurSpeed = horizontalSpeed;
float x = transform.position.x + horizontalSpeed; float x = transform.position.x + horizontalSpeed;

Loading…
Cancel
Save