Esempio n. 1
0
        public MushroomSprite(Mushroom redMushroom, MushroomType type)
        {
            this.Mushroom = redMushroom;
            this.Texture  = SpriteHolder.PowerUps;
            switch (type)
            {
            case MushroomType.Green:
                this.Row    = (int)SpriteHolder.GreenMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.GreenMushroomCoordinates[1];
                break;

            case MushroomType.Red:
                this.Row    = (int)SpriteHolder.RedMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.RedMushroomCoordinates[1];
                break;

            case MushroomType.Metal:
                this.Row    = (int)SpriteHolder.MetalMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.MetalMushroomCoordinates[1];
                break;
            }

            this.Width  = SpriteHolder.PowerUpWidth;
            this.Height = SpriteHolder.PowerUpHeight;

            this.SpawningCounter = 0;
            this.SpawnDelay      = 0;
        }
Esempio n. 2
0
        private IItem CreateSpawnItem()
        {
            IItem             spawnItem     = new Mushroom(this.CurrentPosition, true, MushroomType.Green);
            PowerupDescriptor randomPowerup = (PowerupDescriptor)this.RandomNumber.Next(0, Enum.GetNames(typeof(PowerupDescriptor)).Length);

            switch (randomPowerup)
            {
            case PowerupDescriptor.Star:
                spawnItem = new Star(this.CurrentPosition, true);
                break;

            case PowerupDescriptor.GreenMushroom:
                spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Green);
                break;

            case PowerupDescriptor.MetalMushroom:
                spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Metal);
                break;

            case PowerupDescriptor.RedMushroom:
                if (this.Level.Mario.IsBig())
                {
                    spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Red);
                }
                else
                {
                    spawnItem = new FireFlower(this.CurrentPosition, true);
                }
                break;
            }
            return(spawnItem);
        }
Esempio n. 3
0
        public void SpawnItem(Vector2 Position, String s)
        {
            IItem i;

            switch (s[1])
            {
            case 'C':
                i = new Coin(Position, false);
                this.level.Items.Add(i);
                break;

            case 'S':
                i = new Star(Position, true);
                this.level.Items.Add(i);
                break;

            case 'R':
                i = new Mushroom(Position, true, MushroomType.Red);
                this.level.Items.Add(i);
                break;

            case 'M':
                i = new Mushroom(Position, true, MushroomType.Metal);
                this.level.Items.Add(i);
                break;

            case '1':
                i = new Mushroom(Position, true, MushroomType.Green);
                this.level.Items.Add(i);
                break;

            case 'F':
                i = new FireFlower(Position, true);
                this.level.Items.Add(i);
                break;
            }
        }
Esempio n. 4
0
 public MushroomCollisionResponder(Mushroom mushroom)
 {
     this.Mushroom = mushroom;
 }