diff --git a/unity/Assets/Game.cs b/unity/Assets/Game.cs new file mode 100644 index 0000000..647bd03 --- /dev/null +++ b/unity/Assets/Game.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class Game : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if (Input.GetKeyDown(KeyCode.R)) + { + SceneManager.LoadScene(SceneManager.GetActiveScene().name); + } + } +} diff --git a/unity/Assets/Game.cs.meta b/unity/Assets/Game.cs.meta new file mode 100644 index 0000000..b40cf70 --- /dev/null +++ b/unity/Assets/Game.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ae6e336b628b3624eab0909498a43f51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index caa5eb3..11861aa 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -92,7 +92,16 @@ public class DragonMovement : MonoBehaviour } if (_stunTime > 0f) { - _rigidbody.AddForce(new Vector2(0f, FlapForce * -.5f)); + _rigidbody.AddForce(new Vector2(FlapForce * -.05f, FlapForce * -.05f)); + transform.Rotate(Vector3.forward, Time.deltaTime * 1000f); + if (_flapTime < 0f) + { + _flapTime = 0f; + } + } + else + { + transform.rotation = Quaternion.identity; } _flapTime -= Time.deltaTime; _stunTime -= Time.deltaTime; @@ -132,7 +141,9 @@ public class DragonMovement : MonoBehaviour horizontalSpeed = -2f; } - transform.position = new Vector3(transform.position.x + horizontalSpeed, transform.position.y+ verticalSpeed, transform.position.z); + float x = transform.position.x + horizontalSpeed; + x = Mathf.Max(x, 32); + transform.position = new Vector3(x, transform.position.y+ verticalSpeed, transform.position.z); } }