public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { MonstersHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering; } else { MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int encounterRate) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // This monster is already available at this location, so overwrite its encounter rate with the new value MonstersHere.First(m => m.MonsterID == monsterID).EncounterRate = encounterRate; } else { MonstersHere.Add(new MonsterEncounter(monsterID, encounterRate)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { //Monster je vec dodan u tu lokaciju pa overwritaj chanceofencounter MonstersHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering; } else { //Monster nije na lokaciji, dodaj ga MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // 这个怪物已经被加入这个地点,所以覆盖ChanceOfEncountering的值 MonstersHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering; } else { // 这个怪物不在这个地点里,所以把他添加进去 MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterId, int encounterChance) { //if monster already exists in location if (MonstersHere.Exists(m => m.MonsterId == monsterId)) { //change the chance of encounter only MonstersHere.First(m => m.MonsterId == monsterId).EncounterChance = encounterChance; } else { MonstersHere.Add(new MonsterEncounter(monsterId, encounterChance)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // This monster already exists at this location so overwrite the Encounter chance with the new number MonstersHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering; } else { //The monster isn't already here so add it. MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // Monster already exists, update ChanceOfEncountering MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEncountering; } else { // Monster does not already exist, add it MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // This monster has already been added to this location. MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEncountering; } else { // This monster is not already at this location, so add it. MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceofEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { //This monster has already loaded so overwrite the chanceOfEncountering with the new number MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceofEncountering; } else { //This monster needs to loaded so add it MonstersHere.Add(new MonsterEncounter(monsterID, chanceofEncountering)); } }
public void AddMonster(int monsterid, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterid)) { //This monster has already been added to this location //So, overwrite the changeOfEncountering with the new number MonstersHere.First(m => m.MonsterID == monsterid).ChanceOfEncounter = chanceOfEncountering; } else { //this monster is not already here, so add it MonstersHere.Add(new MonsterEncounter(monsterid, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // if this monster is already in list: // overwrite ChanceOfEncountering with new value MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEncountering; } else { // otherwise add to list MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
/// <summary> /// 根据怪物ID和出现概率添加怪物 /// </summary> /// <param name="monsterId">怪物ID</param> /// <param name="chanceOfEncountering">出现概率</param> public void AddMonster(int monsterId, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterId == monsterId)) { //这个怪物已经被添加到这个位置。 //所以,用这个新数字来表示遇到的可能性。 MonstersHere.First(m => m.MonsterId == monsterId) .ChanceOfEncountering = chanceOfEncountering; } else { // 这个怪物还没有在这个位置,所以添加它。 MonstersHere.Add(new MonsterEncounter(monsterId, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEnocountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { //This monsted has already been added to the location //So,overwrite the ChanceOfEncountering with the new number. MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEnocountering; } else { //This monster is not already at this locationg so add it. MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEnocountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { // Det her monster er allerede sat in på lokalitionerne. // So vi ændre "ChanceofEnountering" med et nyt nummer. MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEncountering; } else { // This monster is not already at this location, so add it. MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterId, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterId == monsterId)) { // this monster has already been added to this location. // override the chance to see them with a new value MonstersHere.First(m => m.MonsterId == monsterId) .ChanceOfEncountering = chanceOfEncountering; } else { // monster new to the area MonstersHere.Add(new MonsterEncounter(monsterId, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { //Monster already at this location //Only chance of encountering monster is updated MonstersHere.First(m => m.MonsterID == monsterID) .ChanceOfEncountering = chanceOfEncountering; } else { //The monster doesn't exist at this location, so add monster and is chance of being encountering MonstersHere.Add(new MonsterEncouter(monsterID, chanceOfEncountering)); } }
public void AddMonster(int monsterID, int chanceOfEncountering) { //If MonstersHere already has a MonsterEncounter object with that monster ID, then //get first monsterencounter object where the ID matches (should only be 1) and sets the chance //of encountering it to the newly passed in chanceOfEncountering. //Basically, just overwrites it, doesn't add a new MonsterEncounter object. Ensures we don't add //the same monster multiple times if (MonstersHere.Exists(m => m.MonsterID == monsterID)) { MonstersHere.First(m => m.MonsterID == monsterID).ChanceOfEncountering = chanceOfEncountering; } else { //Otherwise, add a new MonsterEncounter object. MonstersHere.Add(new MonsterEncounter(monsterID, chanceOfEncountering)); } }