public void addQuestLogItem(QuestLogItem questLogItem) { if (!myQuestLogItems.Contains(questLogItem)) { myQuestLogItems.Add(questLogItem); } }
//this is a perfect example on how to override the .Equals method //that way when we use .contains on an array list of quest log items, //it will use this equals method to compare them. public override bool Equals(object obj) { QuestLogItem item = obj as QuestLogItem; if (this.Name == item.Name) { return(true); } else { return(false); } }
//adds a quest to the quest log for visual public void addQuestLogItem(string questName, string questDetails, Rectangle itemRect) { QuestLogItem temp = new QuestLogItem(myContentManager, questName, itemRect, questDetails); myQuestLogMenu.addQuestLogItem(temp); }