From d39a288eed7a02c8c42d283896149a8046cfd417 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 26 Mar 2023 22:09:13 -0400 Subject: [PATCH] no speed boost from birds but speed boost from shooting --- unity/Assets/Scripts/DragonMovement.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index 5cf001e..a8fc9cc 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -5,6 +5,7 @@ using UnityEngine; public class DragonMovement : MonoBehaviour { const bool ROTATE_WITH_FLAP = false; + const bool LEAN_WITH_SHOOT = true; [SerializeField] KeyCode FlapKey; Rigidbody2D _rigidbody; @@ -85,7 +86,7 @@ public class DragonMovement : MonoBehaviour Bird bird = collision.GetComponent(); bird.Eat(); Ammo = 5; - _speedBoostTime = 1f; + //_speedBoostTime = 1f; _attackType = bird.AttackType; if (_attackType == AttackType.FIREBALL) @@ -229,6 +230,8 @@ public class DragonMovement : MonoBehaviour if (Ammo <= 0) return; + _speedBoostTime = .25f; + Ammo--; if (_attackType == AttackType.FIREBALL) @@ -265,6 +268,10 @@ public class DragonMovement : MonoBehaviour { transform.eulerAngles = new Vector3(0f, 0f, 30f); } + else if (_speedBoostTime > 0 && LEAN_WITH_SHOOT) + { + transform.eulerAngles = new Vector3(0f, 0f, -15f); + } else { transform.rotation = Quaternion.identity; @@ -325,7 +332,7 @@ public class DragonMovement : MonoBehaviour if (_speedBoostTime > 0f) { - horizontalSpeed *= 2.3333f; + horizontalSpeed *= 2.3333f *3f; } _debugCurSpeed = horizontalSpeed; float x = transform.position.x + horizontalSpeed;