Browse Source

added option for rotating with flap

master
Josh 2 years ago
parent
commit
141d92f18b
  1. 7
      unity/Assets/Scripts/DragonMovement.cs

7
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;

Loading…
Cancel
Save