示例#1
0
 public UndergroundBrickBlock(Vector2 location)
 {
     state           = new UndergroundBrickBlockStateMachine();
     Location        = location;
     initialLocation = location;
     fallingSpeed    = new Vector2(0, 0);
     fallingAcce     = new Vector2(0, 0.5f);
     destinationRect = state.MakeDestinationRectangle(Location);
 }
 public CoinBrickBlock(Vector2 location)
 {
     state           = new CoinBrickBlockStateMachine();
     Location        = location;
     initialLocation = location;
     fallingSpeed    = new Vector2(0, 0);
     fallingAcce     = new Vector2(0, 0.5f);
     destinationRect = state.MakeDestinationRectangle(Location);
     coinAnimation   = new CoinOutOfBlockAnimation(new Vector2(Location.X, Location.Y - Destination.Height));
 }
示例#3
0
 public CoinBrickBlock(Vector2 location)
 {
     state           = new CoinBrickBlockStateMachine();
     Location        = location;
     initialLocation = location;
     fallingSpeed    = new Vector2(GameUtilities.StationaryVelocity, GameUtilities.StationaryVelocity);
     fallingAcce     = new Vector2(GameUtilities.StationaryAcceleration, GameUtilities.BrickBlockFallingSpeed);
     destinationRect = state.MakeDestinationRectangle(Location);
     coinAnimation   = new CoinCollectedFromBlockAnimation[coinNum];
     for (int i = 0; i < coinNum; i++)
     {
         coinAnimation[i] = new CoinCollectedFromBlockAnimation(new Vector2(Location.X, Location.Y - Destination.Height));
     }
 }
示例#4
0
        public void Update()
        {
            if (this.Location.Y >= initialLocation.Y)
            {
                this.Location = initialLocation;
                fallingSpeed  = new Vector2(0, 0);
            }
            else
            {
                this.Location = new Vector2(this.Location.X, this.Location.Y + fallingSpeed.Y);
                fallingSpeed  = new Vector2(0, fallingSpeed.Y + fallingAcce.Y);
            }

            state.Update();
            destinationRect = state.MakeDestinationRectangle(Location);
        }
示例#5
0
        public void Update()
        {
            if (Location.Y >= initialLocation.Y)
            {
                Location     = initialLocation;
                fallingSpeed = new Vector2(GameUtilities.StationaryVelocity, GameUtilities.StationaryVelocity);
            }
            else
            {
                Location     = new Vector2(Location.X, Location.Y + fallingSpeed.Y);
                fallingSpeed = new Vector2(GameUtilities.StationaryVelocity, fallingSpeed.Y + fallingAcce.Y);
            }

            state.Update();
            destinationRect = state.MakeDestinationRectangle(Location);
        }