/// <summary> /// Updates Player 1's movement and facing rotation using the WASD keys and drops bombs using Space /// </summary> private void UpdatePlayer1Movement() { if (unityInput.KeyPressed(KeyCode.W)) //Up movement { rigidBody.velocity = new Vector3(rigidBody.velocity.x, rigidBody.velocity.y, moveSpeed); myTransform.rotation = Quaternion.Euler(0, 0, 0); animator.SetBool("Walking", true); } if (unityInput.KeyPressed(KeyCode.A)) //Left movement { rigidBody.velocity = new Vector3(-moveSpeed, rigidBody.velocity.y, rigidBody.velocity.z); myTransform.rotation = Quaternion.Euler(0, 270, 0); animator.SetBool("Walking", true); } if (unityInput.KeyPressed(KeyCode.S)) //Down movement { rigidBody.velocity = new Vector3(rigidBody.velocity.x, rigidBody.velocity.y, -moveSpeed); myTransform.rotation = Quaternion.Euler(0, 180, 0); animator.SetBool("Walking", true); } if (unityInput.KeyPressed(KeyCode.D)) //Right movement { rigidBody.velocity = new Vector3(moveSpeed, rigidBody.velocity.y, rigidBody.velocity.z); myTransform.rotation = Quaternion.Euler(0, 90, 0); animator.SetBool("Walking", true); } if (canDropBombs && unityInput.KeyDown(KeyCode.Space)) //Drop bomb { DropBomb(); } }
public IEnumerator CanDropBombDropBomb() { yield return(null); unityInput.KeyDown(KeyCode.Space).Returns(true); player.Contruct(unityInput); Assert.AreEqual(GameObject.FindObjectsOfType <Bomb>().Length, 0); yield return(null); Assert.AreEqual(GameObject.FindObjectsOfType <Bomb>().Length, 1); }