private void Update() { switch (state) { default: case State.WaitingToStart: if (TestInput()) { state = State.Playing; birdRigidbody2D.bodyType = RigidbodyType2D.Dynamic; Jump(); OnStartedPlaying?.Invoke(this, EventArgs.Empty); } break; case State.Playing: if (TestInput()) { Jump(); } transform.eulerAngles = new Vector3(0, 0, birdRigidbody2D.velocity.y * .15f); break; case State.Dead: break; } }
private void Update() { switch (state) { default: case State.WaitingToStart: if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) { state = State.Playing; rigidBody.bodyType = RigidbodyType2D.Dynamic; Jump(); OnStartedPlaying?.Invoke(this, EventArgs.Empty); } break; case State.Playing: if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) { Jump(); } transform.eulerAngles = new Vector3(0, 0, rigidBody.velocity.y * 0.15f); break; case State.Dead: break; } }