예제 #1
0
        //CollisionGrid CollisionGrid;
        public HiddenBlockModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, ItemModelFactory itemModelFactory, string itemType, int numOfItems)
            : base(blockSpriteFactory)
        {
            //Initialize state first
            CurrentState = new HiddenBlockStandardState(this);
            CurrentState.Enter(null);

            //Define the characteristics of a brick block here
            Position     = coordinates;
            CurrentFrame = 0;
            //If additional frames of QuestionBlocks are added, update Columns
            Columns    = 1;
            Rows       = 1;
            LayerDepth = 1;
            Scale      = new Vector2(10, 10);
            Width      = Texture.Width / Columns;
            Height     = Texture.Height / Rows;
            Velocity   = velocity;
            //Particles
            Texture2D        brickTexture = BlockSpriteFactory.GetBlockSprite("brick");
            List <Texture2D> textures     = new List <Texture2D>();

            textures.Add(brickTexture);
            ParticleEngine = new ParticleEngine(textures, Position);

            //Items
            ItemModelFactory = itemModelFactory;
            NumOfItems       = numOfItems;
            ItemType         = itemType;
            //CollisionGrid = collisionGrid;
        }
예제 #2
0
 protected BlockModel(BlockSpriteFactory blockSpriteFactory)
 {
     BlockSpriteFactory = blockSpriteFactory;
     Sprite             = new BlockSprite(this);
     Color = Color.White;
     Time  = new System.Diagnostics.Stopwatch();
 }
예제 #3
0
        public void Update(GameTime gameTime)
        {
            elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60;

            if (elapsedFrames > 10)
            {
                switch (frame)
                {
                case MysteryBlockFrame.FirstFrame:
                    frame        = MysteryBlockFrame.Flash1;
                    currentFrame = BlockSpriteFactory.MysteryBlock(frame);
                    break;

                case MysteryBlockFrame.Flash1:
                    frame        = MysteryBlockFrame.Flash2;
                    currentFrame = BlockSpriteFactory.MysteryBlock(frame);
                    break;

                case MysteryBlockFrame.Flash2:
                    frame        = MysteryBlockFrame.FirstFrame;
                    currentFrame = BlockSpriteFactory.MysteryBlock(frame);
                    break;
                }

                elapsedFrames = 0;
            }
        }
예제 #4
0
        public BrickBlockModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, Color color)
            : base(blockSpriteFactory)
        {
            //For Secret Bricks

            //Initialize state first
            CurrentState = new BrickBlockStandardState(this);
            CurrentState.Enter(null);

            //Define the characteristics of a brick block here
            Position     = coordinates;
            CurrentFrame = 0;
            Columns      = 1;
            Rows         = 1;
            LayerDepth   = 1;

            //Particles
            Texture2D        brickTexture = BlockSpriteFactory.GetBlockSprite("brickcolored");
            List <Texture2D> textures     = new List <Texture2D>();

            textures.Add(brickTexture);
            ParticleEngine = new ParticleEngine(textures, Position);
            Color          = color;

            Texture  = brickTexture;
            Scale    = new Vector2(10, 10);
            Width    = Texture.Width / Columns;
            Height   = Texture.Height / Rows;
            Velocity = velocity;
        }
예제 #5
0
        public WarpPipeEnemyModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, EnemyModelFactory enemyModelFactory, string enemyType, int numOfEnemies, CollisionGrid collisionGrid)
            : base(blockSpriteFactory)
        {
            //Constructor for warppipe that hides enemies
            //Initialize Texture first
            Texture = BlockSpriteFactory.GetBlockSprite("pipetop");

            CurrentState = new WarpPipeEntityStandardState(this);
            CurrentState.Enter(null);
            //Define the characteristics of a pipe block here
            Position     = coordinates;
            CurrentFrame = 0;
            Columns      = 1;
            Rows         = 1;
            LayerDepth   = 1;
            Scale        = new Vector2(10, 10);
            Width        = Texture.Width / Columns;
            Height       = Texture.Height / Rows;
            Velocity     = velocity;

            //Enemies
            EnemyModelFactory    = enemyModelFactory;
            EnemyType            = enemyType;
            CollisionGrid        = collisionGrid;
            EnemyModel           = enemyModelFactory.GetEnemyModel(enemyType, coordinates, Velocity);
            EnemyModel.IsVisible = false;
            NumOfEnemies         = numOfEnemies;
        }
예제 #6
0
        //CollisionGrid CollisionGrid;
        public QuestionBlockModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, ItemModelFactory itemModelFactory, string itemType, int numOfItems)
            : base(blockSpriteFactory)
        {
            //Initialize state first
            CurrentState = new QuestionBlockStandardState(this);
            CurrentState.Enter(null);

            //Define the characteristics of a brick block here
            Position     = coordinates;
            CurrentFrame = 0;
            //If additional frames of QuestionBlocks are added, update Columns
            Columns     = 3;
            Rows        = 1;
            LayerDepth  = 1;
            Scale       = new Vector2(10, 10);
            Width       = Texture.Width / Columns;
            Height      = Texture.Height / Rows;
            TotalFrames = 3;
            Velocity    = velocity;

            //Items
            ItemModelFactory = itemModelFactory;
            NumOfItems       = numOfItems;
            ItemType         = itemType;
            ItemModel        = itemModelFactory.GetItemModel(ItemType, coordinates, velocity);
            //CollisionGrid = collisionGrid;
            ItemModel.IsVisible = false;
        }
예제 #7
0
 public StairBlockSprite(int posX, int posY)
 {
     Location     = new Vector2(posX, posY);
     WidthHeight  = new Vector2(BlockSpriteFactory.BLOCK_WIDTH, BlockSpriteFactory.BLOCK_HEIGHT);
     Boundary     = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);
     currentFrame = BlockSpriteFactory.StairBlock();
     EntityType   = TileMapInterpreter.Entities.STAIR;
 }
예제 #8
0
 public HiddenBlockSprite(int posX, int posY, HiddenBlockType type)
 {
     Location    = new Vector2(posX, posY);
     WidthHeight = new Vector2(BlockSpriteFactory.BLOCK_WIDTH, BlockSpriteFactory.BLOCK_HEIGHT);
     Boundary    = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);
     //this.type = type;
     currentFrame = BlockSpriteFactory.HiddenBlock(type);
     EntityType   = TileMapInterpreter.Entities.HIDDEN_HIDDEN;
 }
예제 #9
0
 public MysteryBlockSprite(int posX, int posY, MysteryBlockFrame frame)
 {
     Location     = new Vector2(posX, posY);
     WidthHeight  = new Vector2(BlockSpriteFactory.BLOCK_WIDTH, BlockSpriteFactory.BLOCK_HEIGHT);
     Boundary     = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);
     this.frame   = frame;
     currentFrame = BlockSpriteFactory.MysteryBlock(frame);
     EntityType   = TileMapInterpreter.Entities.QUESTION_COIN;
 }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            ItemModel.Update(gameTime);

            if (NumOfItems == 0)
            {
                //Otherwise turn the brick into used block.
                Texture = BlockSpriteFactory.GetBlockSprite("used");
            }
        }
예제 #11
0
 public UsedBlockModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity)
     : base(blockSpriteFactory)
 {
     //Initialize Texture first
     Texture = BlockSpriteFactory.GetBlockSprite("used");
     //Define the characteristics of a brick block here
     Position     = coordinates;
     CurrentFrame = 0;
     Columns      = 1;
     Rows         = 1;
     LayerDepth   = 1;
     Scale        = new Vector2(10, 10);
     Width        = Texture.Width / Columns;
     Height       = Texture.Height / Rows;
     Velocity     = velocity;
 }
예제 #12
0
        public BrickBlockSprite(int posX, int posY, bool explode, bool hit)
        {
            Location     = new Vector2(posX, posY);
            WidthHeight  = new Vector2(BlockSpriteFactory.BLOCK_WIDTH, BlockSpriteFactory.BLOCK_HEIGHT);
            Boundary     = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);
            isHit        = hit;
            isExplode    = explode;
            iterations   = 0;
            currentFrame = BlockSpriteFactory.BrickBlock();
            EntityType   = TileMapInterpreter.Entities.BRICK_NOITEM;

            if (explode)
            {
                EntityType = TileMapInterpreter.Entities.DESTROYED;
                // Remove existing brick
                currentFrame = BlockSpriteFactory.EmptyBlock();

                // Create exploded pieces
                explodedFrames = new Rectangle[4];
                for (int i = 0; i < 4; i++)
                {
                    explodedFrames[i] = BlockSpriteFactory.ExplodedBrickBlock();
                }

                explodedPosX    = new int[4];
                explodedPosY    = new int[4];
                explodedPosX[0] = posX;
                explodedPosY[0] = posY;
                explodedPosX[1] = posX + 8;
                explodedPosY[1] = posY;
                explodedPosX[2] = posX;
                explodedPosY[2] = posY + 8;
                explodedPosX[3] = posX + 8;
                explodedPosY[3] = posY + 8;

                originalExploY = new int[4];
                originalExploX = new int[4];
                explodedPosX.CopyTo(originalExploX, 0);
                explodedPosY.CopyTo(originalExploY, 0);
            }
        }
        //CollisionGrid CollisionGrid;
        public BrickBlockWithItemModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, ItemModelFactory itemModelFactory, string itemType, int numOfItems)
            : base(blockSpriteFactory)
        {
            //If the Brick block has an Item
            //Initialize state first
            CurrentState = new BrickBlockWithItemStandardState(this);
            CurrentState.Enter(null);

            IBlockStates previousState = CurrentState;

            CurrentState = new BlockHasItemState(this);
            CurrentState.Enter(previousState);
            //Define the characteristics of a brick block here
            Position     = coordinates;
            CurrentFrame = 0;
            Columns      = 1;
            Rows         = 1;
            LayerDepth   = 1;
            Scale        = new Vector2(10, 10);
            Width        = Texture.Width / Columns;
            Height       = Texture.Height / Rows;
            Velocity     = velocity;

            //Particles
            Texture2D        brickTexture = BlockSpriteFactory.GetBlockSprite("brick");
            List <Texture2D> textures     = new List <Texture2D>();

            textures.Add(brickTexture);
            ParticleEngine = new ParticleEngine(textures, Position);

            //Items
            ItemModelFactory = itemModelFactory;
            NumOfItems       = numOfItems;
            ItemType         = itemType;
            //CollisionGrid = collisionGrid;
            ItemModel           = itemModelFactory.GetItemModel(ItemType, coordinates, Velocity);
            ItemModel.IsVisible = false;
        }
예제 #14
0
        public WarpPipeBlockModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity)
            : base(blockSpriteFactory)
        {
            //Initialize Texture first
            Texture = BlockSpriteFactory.GetBlockSprite("pipetop");

            CurrentState = new WarpPipeStandardState(this);
            CurrentState.Enter(null);
            //Define the characteristics of a pipe block here
            Position     = coordinates;
            CurrentFrame = 0;
            Columns      = 1;
            Rows         = 1;
            LayerDepth   = 1;
            Scale        = new Vector2(10, 10);
            Width        = Texture.Width / Columns;
            Height       = Texture.Height / Rows;
            Velocity     = velocity;


            //Enemies
            //EnemyModelFactory = enemyModelFactory;
            //NumOfEnemies = numOfEnemies;
        }
예제 #15
0
        public FlagPoleModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity)
            : base(blockSpriteFactory)
        {
            //Initialize state first
            CurrentState = new FlagPoleStandardState(this);
            CurrentState.Enter(null);

            //Define the characteristics of a brick block here
            Position = coordinates;
            //If additional frames of QuestionBlocks are added, update Columns
            Columns     = 5;
            Rows        = 1;
            LayerDepth  = 1;
            Scale       = new Vector2(10, 10);
            Width       = Texture.Width / Columns;
            Height      = Texture.Height / Rows;
            Velocity    = velocity;
            Coordinates = coordinates;
            //Particles
            //Texture2D brickTexture = BlockSpriteFactory.GetBlockSprite(CurrentState, "brick");
            //List<Texture2D> textures = new List<Texture2D>();
            //textures.Add(brickTexture);
            //ParticleEngine = new ParticleEngine(textures, Position);
        }