public void Update() { Physics.UpdatePosition(); switch (Health) { case GoombaHealth.Flipped: countToDeath++; if (countToDeath == removeForFlipped) { this.NeedsRemoved(); } if (!(GoombaSprite is FlippedGoombaSprite)) { GoombaSprite = GoombaSpriteFactory.Instance.GetFlippedSprite(); } break; case GoombaHealth.Stomped: countToDeath++; if (countToDeath == removeForStomped) { this.NeedsRemoved(); } if (!(GoombaSprite is StompedGoombaSprite)) { GoombaSprite = GoombaSpriteFactory.Instance.GetStompedSprite(); } break; case GoombaHealth.Normal: if (movingLeft && !(GoombaSprite is LeftMovingGoombaSprite)) { GoombaSprite = GoombaSpriteFactory.Instance.GetLeftMovingSprite(); } else if (!movingLeft && !(GoombaSprite is RightMovingGoombaSprite)) { GoombaSprite = GoombaSpriteFactory.Instance.GetRightMovingSprite(); } break; } GoombaSprite.Update(); }
public GoombaStateMachine(Vector2 location) { Location = location; GoombaSprite = GoombaSpriteFactory.Instance.GetLeftMovingSprite(); }