示例#1
0
 public static void SearchForGold()
 {
     for (int i = DungeonMap.GoldPiles.Count - 1; i >= 0; i--)
     {
         if (Game.Player.X == DungeonMap.GoldPiles[i].X && Game.Player.Y == DungeonMap.GoldPiles[i].Y)
         {
             GoldPile.AddGoldToPlayer(DungeonMap.GoldPiles[i].Gold);
             Game.MessageLog.Add($"{Game.Player.Name} acquired {DungeonMap.GoldPiles[i].Gold} Gold.");
             DungeonMap.GoldPiles.Remove(DungeonMap.GoldPiles[i]);
             // Do not use break here due to one cell possibly having more than one pile of gold
         }
     }
 }
示例#2
0
 private static void AddGoldToPlayer(GoldPile goldPile)
 {
     Game.Player.Gold += goldPile.Gold;
 }