예제 #1
0
        public ArrayList FactoryMethod(string name, Vector2 posS, Vector2 posE)
        {
            ArrayList list = new ArrayList();

            for (int x = 0; x < (posE.X - posS.X) / 16; x++)
            {
                for (int y = 0; y < (posE.Y - posS.Y) / 16; y++)
                {
                    Vector2        pos        = new Vector2(posS.X + x * 16, posS.Y + y * 16);
                    MoveParameters parameters = new MoveParameters(false);
                    parameters.SetPosition(pos.X, pos.Y);
                    switch (name)
                    {
                    case "Brick":
                        list.Add(GetBrickBlock(parameters, new ArrayList()));
                        break;

                    case "QuestionB":
                        list.Add(GetQuestionBlock(parameters, new ArrayList()));
                        break;

                    case "HiddenB":
                        list.Add(GetHiddenBlock(parameters, new ArrayList()));
                        break;

                    case "UsedB":
                        list.Add(GetUsedBlock(parameters));
                        break;

                    case "FloorB":
                        list.Add(GetFloorBlock(parameters));
                        break;

                    case "StairB":
                        list.Add(GetStairBlock(parameters));
                        break;

                    case "DestructibleStairB":
                        list.Add(GetDestructibleStairBlock(parameters));
                        break;

                    default: break;
                    }
                }
            }
            return(list);
        }
예제 #2
0
        private float Clock;    // The Clock used for Died Animation

        public Mario(Texture2D[][] marioSpriteSheets, Vector2 location)
        {
            MarioState = new MarioState(this);
            //initialize position and velocity, where the MoveParameter itself will not do.
            Parameters = new MoveParameters(true);
            Parameters.SetPosition(location.X, location.Y);
            Parameters.SetVelocity(0, 0);
            JumpHigher = false; Dive = false; AutomaticallyMoving = false; Shoot = false; DiveRight = false;
            //store 13 Mario textures
            MarioSpriteSheets = marioSpriteSheets ?? throw new ArgumentNullException(nameof(marioSpriteSheets));
            ActionSprites     = new ISprite[6] {
                new AnimatedSprite(MarioSpriteSheets[0][0], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][1], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][2], new Point(1, 3), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][3], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][1], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][5], new Point(1, 1), Parameters)
            };
            FlagSprite    = new AnimatedSprite(MarioSpriteSheets[0][4], new Point(1, 1), Parameters);
            CurrentSprite = ActionSprites[0];
            Clock         = 0;
        }
 //void Update(GameTime gameTime) { }
 public BackgroundCharacter(Texture2D texture, Vector2 pos)
 {
     Parameters = new MoveParameters(false);
     Parameters.SetPosition(pos.X, pos.Y);
     Background = new AnimatedSprite(texture, new Point(1, 1), Parameters);
 }