Ejemplo n.º 1
0
        public override void Update(double currentTime)
        {
            // This runs once every frame. Other sorts of logic might run from here. For example,
            // if the target ship was controlled by the computer, you might run AI from this routine.

            // Use the stored key information to control the ship.
            if (actions [(int)PlayerActions.Forward])
            {
                controlledShip.ActivateMainEngine();
            }
            else
            {
                controlledShip.DeactivateMainEngine();
            }

            if (actions [(int)PlayerActions.Back])
            {
                controlledShip.ReverseThrust();
            }

            if (actions [(int)PlayerActions.Left])
            {
                controlledShip.RotateShipLeft();
            }

            if (actions [(int)PlayerActions.Right])
            {
                controlledShip.RotateShipRight();
            }

            if (actions [(int)PlayerActions.Action])
            {
                controlledShip.AttemptMissileLaunch(currentTime);
            }
        }