void Update() { // Send input to ship from mobile controllers. if (CrossPlatformInputManager.GetButtonDown("Fire")) { ship.Fire(); } else if (CrossPlatformInputManager.GetButton("Fire")) { ship.FireHeld(); } if (CrossPlatformInputManager.GetButtonDown("Teleport")) { ship.Teleport(); } Vector2 dir = new Vector2( CrossPlatformInputManager.GetAxis("Horizontal"), CrossPlatformInputManager.GetAxis("Vertical") ); if (dir != Vector2.zero) { ship.Rotate(dir); } }
public void CannotReactWhileInactive() { var view = Substitute.For <IShipView> (); ShipCtrl ship = new ShipCtrl(view); ship.Destroyed(); ship.Thrust(); ship.Rotate(0); ship.Teleport(); view.DidNotReceive().Thrust(); view.DidNotReceive().Rotate(0); view.DidNotReceive().Teleport(Arg.Any <Action> ()); ship.Respawn(); ship.Thrust(); ship.Rotate(0); ship.Fire(); ship.Teleport(); view.Received(1).Thrust(); view.Received(1).Rotate(0); view.Received(1).Teleport(Arg.Any <Action> ()); }