public virtual void MoveRight() { if (Location.X != 19) { if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X + 1, Location.Y] is Player) { Console.SetCursorPosition(Location.X + 1, Location.Y); Animation.HitAnim(); GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X + 1, Location.Y]); } else if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X + 1, Location.Y] == null) { Location.X++; GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y] = this; GameManager.Stages[GameManager.CurrentStage].Map[Location.X - 1, Location.Y] = null; } } }
public virtual void MoveUp() { if (Location.Y != 0) { if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y - 1] is Player) { Console.SetCursorPosition(Location.X, Location.Y - 1); Animation.HitAnim(); GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y - 1]); } else if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y - 1] == null) { Location.Y--; GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y] = this; GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y + 1] = null; } } }
public void Shoot(Direction direction) { switch (direction) { case Direction.North: for (int i = 1; i < 20 - (19 - Location.Y); i++) { Console.SetCursorPosition(Location.X, Location.Y - i); if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y - i] != null) { GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y - i]); Animation.HitAnim(); return; } Animation.VertLaserAnim(); } break; case Direction.East: for (int i = 1; i < 20 - Location.X; i++) { Console.SetCursorPosition(Location.X + i, Location.Y); if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X + i, Location.Y] != null) { GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X + i, Location.Y]); Animation.HitAnim(); return; } Animation.HoriLaserAnim(); } break; case Direction.South: for (int i = 1; i < 20 - Location.Y; i++) { Console.SetCursorPosition(Location.X, Location.Y + i); if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y + i] != null) { GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X, Location.Y + i]); Animation.HitAnim(); return; } Animation.VertLaserAnim(); } break; case Direction.West: for (int i = 1; i < 20 - (19 - Location.X); i++) { Console.SetCursorPosition(Location.X - i, Location.Y); if (GameManager.Stages[GameManager.CurrentStage].Map[Location.X - i, Location.Y] != null) { GameManager.SubtractLife(GameManager.Stages[GameManager.CurrentStage].Map[Location.X - i, Location.Y]); Animation.HitAnim(); return; } Animation.HoriLaserAnim(); } break; default: break; } }