Exemplo n.º 1
0
        public void Trigger()
        {
            if (Used)
            {
                return;
            }
            IGameObject newObject = null;

            switch (QuestionmarkBlockType)
            {
            case QuestionmarkBlockTypeEnums.Flower:
                newObject = new Flower(new Vector2(Location.X, Location.Y - 2));
                SoundManager.Instance.PlayPowerUpAppearsSound();
                break;

            case QuestionmarkBlockTypeEnums.GreenMushroom:
                newObject = new GreenMushroom(new Vector2(Location.X, Location.Y - 2));
                SoundManager.Instance.PlayPowerUpAppearsSound();
                break;

            case QuestionmarkBlockTypeEnums.RedMushroom:
                newObject = new RedMushroom(new Vector2(Location.X, Location.Y - 2));
                SoundManager.Instance.PlayPowerUpAppearsSound();
                break;

            case QuestionmarkBlockTypeEnums.Star:
                newObject = new Star(new Vector2(Location.X, Location.Y - 2));
                SoundManager.Instance.PlayPowerUpAppearsSound();
                break;

            default:
                coinAnimation.StartAnimation();
                CoinSystem.Instance.AddCoin();
                ScoringSystem.AddPointsForCoin(this);
                break;
            }
            if (newObject != null)
            {
                newObject.Location = new Vector2(Location.X, Location.Y - 2);
                GameUtilities.GameObjectManager.AddItem(newObject);
            }

            stateMachine.BeTriggered();
        }
Exemplo n.º 2
0
        public void Trigger()
        {
            if (Used)
            {
                return;
            }
            IGameObject newObject = null;

            switch (hiddenItem)
            {
            case ItemType.Flower:
                newObject = new FireFlower(new Vector2(Location.X, Location.Y - 2));
                SoundManager.Instance.PlayMushStarSound();
                break;

            case ItemType.UpMushroom:
                newObject = new UpMushroom(new Vector2(Location.X, Location.Y - 16));
                SoundManager.Instance.PlayMushStarSound();
                break;

            case ItemType.SuperMushroom:
                newObject = new SuperMushroom(new Vector2(Location.X, Location.Y - 16));
                SoundManager.Instance.PlayMushStarSound();
                break;

            case ItemType.Star:
                newObject = new Star(new Vector2(Location.X, Location.Y - 16));
                SoundManager.Instance.PlayMushStarSound();
                break;

            default:
                coinAnimation.StartAnimation();
                CoinSystem.Instance.AddCoin();
                ScoringSystem.AddPointsForCoin(this);
                break;
            }
            if (newObject != null)
            {
                GameObjectManager.itemList.Add(newObject);
            }

            stateMachine.BeTriggered();
        }