public void Update() { if (State == AnimationState.IsPlaying) { velocityY = velocityY + accelerationY; location.Y = location.Y + velocityY; if (location.Y > endLocationY) { State = AnimationState.Stopped; scoreAnimation.StartAnimation(); } } coinSprite.Update(); }
public void Trigger() { if (coinNum > 0) { Location = new Vector2(Location.X, initialLocation.Y - 5); coinNum--; CoinSystem.Instance.AddCoin(); ScoringSystem.AddPointsForCoin(this); coinAnimation.StartAnimation(); } else { state.BeTriggered(); } }
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(); }
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(); }