예제 #1
0
파일: Location.cs 프로젝트: HEFLINGA/WPFRPG
 public void AddMonster(int monsterID, int chanceOfEncountering)
 {
     if (MonsterHere.Exists(m => m.MonsterID == monsterID))
     {
         MonsterHere.First(m => m.MonsterID == monsterID)
         .ChanceOfEncountering = chanceOfEncountering;
     }
     else
     {
         MonsterHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering));
     }
 }
예제 #2
0
 public void AddMonster(int monsterID, int chanceOfEncountering)
 {
     if (MonsterHere.Exists(m => m.MonsterID == monsterID))
     {
         //Hvis monster er her, reset gammel værdi med ny værdi.
         MonsterHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering;
     }
     else
     {
         //Hvis der ikke er noget monster, tilføj monster.
         MonsterHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering));
     }
 }
예제 #3
0
 public void AddMonster(int monsterID, int chanceOfEncounter)
 {
     if (MonsterHere.Exists(m => m.MonsterID == monsterID))
     {
         // This monster has already been loaded in this location
         // so, overwrite the ChanceOfEncounter with the new number
         MonsterHere.First(m => m.MonsterID == monsterID)
         .ChanceOfEncounter = chanceOfEncounter;
     }
     else
     {
         // This monster is not already at this location, so add it.
         MonsterHere.Add(new MonsterEncounter(monsterID, chanceOfEncounter));
     }
 }