Fire() 공개 메소드

public Fire ( Vector2 theStartPosition, Vector2 theSpeed, Vector2 theDirection ) : void
theStartPosition Vector2
theSpeed Vector2
theDirection Vector2
리턴 void
예제 #1
0
        private void shootRocket(Map map)
        {
            if (mCurrentState == State.Walking)
            {
                //Check if there are any invisible rockets in the list
                bool    createNewRocket = true;
                Vector2 rocketDirection;
                if (mDirection.X == MOVE_LEFT)
                {
                    rocketDirection = new Vector2(MOVE_LEFT, 0);
                }
                else
                {
                    rocketDirection = new Vector2(MOVE_RIGHT, 0);
                }
                Vector2 rocketStartPosition =
                    map.screenToWorld(new Vector2(mPosition.X + rocketDirection.X * X_FRAME_WIDTH + X_ROCKET_OFFSET,
                                                  mPosition.Y + Y_ROCKET_OFFSET));

                Vector2 rocketSpeed = new Vector2(ROCKET_SPEED, 0);
                foreach (Rocket aRocket in mRockets)
                {
                    if (!aRocket.visible)
                    {
                        createNewRocket = false;
                        aRocket.Fire(rocketStartPosition, rocketSpeed, rocketDirection);
                        break;
                    }
                }

                if (createNewRocket)
                {
                    Rocket aRocket = new Rocket();
                    aRocket.LoadContent(mContentManager);
                    aRocket.Fire(rocketStartPosition, rocketSpeed, rocketDirection);
                    mRockets.Add(aRocket);
                }
            }
        }
예제 #2
0
        private void shootRocket()
        {
            if (mCurrentState == State.Walking)
            {
                //Check if there are any invisible rockets in the list
                bool    createNewRocket = true;
                Vector2 rocketDirection;
                if (mDirection.X == MOVE_LEFT)
                {
                    rocketDirection = new Vector2(MOVE_LEFT, 0);
                }
                else
                {
                    rocketDirection = new Vector2(MOVE_RIGHT, 0);
                }
                foreach (Rocket aRocket in mRockets)
                {
                    if (!aRocket.visible)
                    {
                        createNewRocket = false;
                        aRocket.Fire(mPosition + new Vector2(rocketDirection.X * (X_FRAME_WIDTH / 2), 0),
                                     new Vector2(ROCKET_SPEED, 0), rocketDirection);
                        break;
                    }
                }

                if (createNewRocket)
                {
                    Rocket aRocket = new Rocket();
                    aRocket.LoadContent(mContentManager);
                    aRocket.Fire(mPosition + new Vector2(rocketDirection.X * (X_FRAME_WIDTH / 2), 0),
                                 new Vector2(ROCKET_SPEED, 0), rocketDirection);
                    mRockets.Add(aRocket);
                }
            }
        }
예제 #3
0
        private void shootRocket()
        {
            if (mCurrentState == State.Walking)
            {
                //Check if there are any invisible rockets in the list
                bool createNewRocket = true;
                Vector2 rocketDirection;
                if (mDirection.X == MOVE_LEFT)
                {
                    rocketDirection = new Vector2(MOVE_LEFT, 0);
                }
                else
                {
                    rocketDirection = new Vector2(MOVE_RIGHT, 0);
                }
                foreach (Rocket aRocket in mRockets)
                {
                    if(!aRocket.visible){
                        createNewRocket = false;
                        aRocket.Fire(mPosition + new Vector2(rocketDirection.X*(X_FRAME_WIDTH / 2),0),
                            new Vector2(ROCKET_SPEED, 0), rocketDirection);
                        break;
                    }
                }

                if (createNewRocket)
                {
                    Rocket aRocket = new Rocket();
                    aRocket.LoadContent(mContentManager);
                    aRocket.Fire(mPosition + new Vector2(rocketDirection.X*(X_FRAME_WIDTH / 2), 0),
                            new Vector2(ROCKET_SPEED, 0), rocketDirection);
                    mRockets.Add(aRocket);
                }
            }
        }
예제 #4
0
        private void shootRocket(Map map)
        {
            if (mCurrentState == State.Walking)
            {
                //Check if there are any invisible rockets in the list
                bool createNewRocket = true;
                Vector2 rocketDirection;
                if (mDirection.X == MOVE_LEFT)
                {
                    rocketDirection = new Vector2(MOVE_LEFT, 0);
                }
                else
                {
                    rocketDirection = new Vector2(MOVE_RIGHT, 0);
                }
                Vector2 rocketStartPosition =
                    map.screenToWorld(new Vector2(mPosition.X + rocketDirection.X * X_FRAME_WIDTH + X_ROCKET_OFFSET,
                        mPosition.Y + Y_ROCKET_OFFSET));

                Vector2 rocketSpeed = new Vector2(ROCKET_SPEED, 0);
                foreach (Rocket aRocket in mRockets)
                {
                    if(!aRocket.visible){
                        createNewRocket = false;
                        aRocket.Fire(rocketStartPosition, rocketSpeed, rocketDirection);
                        break;
                    }
                }

                if (createNewRocket)
                {
                    Rocket aRocket = new Rocket();
                    aRocket.LoadContent(mContentManager);
                    aRocket.Fire(rocketStartPosition, rocketSpeed, rocketDirection);
                    mRockets.Add(aRocket);
                }
            }
        }