예제 #1
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            //Get the direction from the player (controller)
            Vector2 direction = player.input.ShipMoveDirNormal();

            //Check is the player is trying to move
            //Since update (GameObject) will try and move the ship
            //if player is not trying to move we flag it false
            if (direction.X == 0 && direction.Y == 0)
            {
                obj.moving = false;
            }
            else
            {
                obj.moving = true;             //re-flag true in case set to false

                direction.Normalize();         //just in case....
                obj.SetRotation(direction);

                //Since SetRotation() above, also turns the "face" direction
                //we need to correct this for the human players whose ships
                //always face directly upwards on the screen
                obj.SetFaceDir(VecUtil.GetNormUP());
            }
        }
예제 #2
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            timer.Update(info.gameTime);

            switch (timer.Current)
            {
            case Timer2.TimerNum.First:
                obj.SetRotation(VecUtil.GetNormLeft());
                break;

            case Timer2.TimerNum.Second:
                obj.SetRotation(VecUtil.GetNormRight());
                break;
            }

            obj.SetFaceDir(VecUtil.GetNormDown());
        }
예제 #3
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            //Get the direction from the player (controller)
            Vector2 direction = player.input.ShipMoveDirNormal();

            //Check is the player is trying to move
            //Since update (GameObject) will try and move the ship
            //if player is not trying to move we flag it false
            if (direction.X == 0 && direction.Y == 0)
                obj.moving = false;
            else
            {
                obj.moving = true;             //re-flag true in case set to false

                direction.Normalize();          //just in case....
                obj.SetRotation(direction);

                //Since SetRotation() above, also turns the "face" direction
                //we need to correct this for the human players whose ships
                //always face directly upwards on the screen
                obj.SetFaceDir(VecUtil.GetNormUP());
            }
        }
예제 #4
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            timer.Update(info.gameTime);

            switch (timer.Current)
            {
                case Timer2.TimerNum.First:
                    obj.SetRotation(VecUtil.GetNormLeft());
                    break;

                case Timer2.TimerNum.Second:
                    obj.SetRotation(VecUtil.GetNormRight());
                    break;
            }

            obj.SetFaceDir(VecUtil.GetNormDown());
        }