From 141d92f18b6ccda1c61f4753237efa4d0aeec9dd Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 26 Mar 2023 21:49:36 -0400 Subject: [PATCH] added option for rotating with flap --- unity/Assets/Scripts/DragonMovement.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index 2c4e452..5cf001e 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -4,6 +4,8 @@ using UnityEngine; public class DragonMovement : MonoBehaviour { + const bool ROTATE_WITH_FLAP = false; + [SerializeField] KeyCode FlapKey; Rigidbody2D _rigidbody; float _flapTime = 0f; @@ -206,6 +208,7 @@ public class DragonMovement : MonoBehaviour { _flapTime = FlapLength; _animator.Play("fly"); + transform.eulerAngles = new Vector3(-45f, transform.eulerAngles.y, transform.eulerAngles.z); ShowNormalAmmo(); } @@ -258,6 +261,10 @@ public class DragonMovement : MonoBehaviour _flapTime = 0f; } } + else if (_flapTime > 0 && ROTATE_WITH_FLAP) + { + transform.eulerAngles = new Vector3(0f, 0f, 30f); + } else { transform.rotation = Quaternion.identity;