private void createList() //Used to be private //adding it to the list inside this method loses all the property values { BountyHunter CharacterOne = new BountyHunter("Ganon", "Exotype", Character.CharacterType.BountyHunterX, "Rifle"); //This type of instantiation needs a constructor in the other class with properties set to the arguments in the body BountyHunter CharacterTwo = new BountyHunter("Sephiroth", "Exobase", Character.CharacterType.BountyHunterX, "Lazer"); BountyHunter CharacterThree = new BountyHunter("Madara", "Earthling", Character.CharacterType.JediKnight, "Sword-Gun"); Jedi CharacterFour = new Jedi("Luke", "Earthling", Character.CharacterType.JediKnight, "Blue"); //A reminder that order matters. Jedi CharacterFive = new Jedi("Anakin", "Earthling", Character.CharacterType.JediKnight, "Green"); Jedi CharacterSix = new Jedi("Tiger", "Earthling", Character.CharacterType.JediKnight, "Black"); //This forces behavior because the constructor in the child classes exist Characters.Add(CharacterOne); Characters.Add(CharacterTwo); Characters.Add(CharacterThree); NiceCharacters.Add(CharacterFour); NiceCharacters.Add(CharacterFive); NiceCharacters.Add(CharacterSix); foreach (Character entity in Characters) { MasterList.Add(entity); } foreach (Character entity2 in NiceCharacters) { MasterList.Add(entity2); } }
public void AddToCharacters(BountyHunter model) //Add this last minute but IDK why. { Characters.Add(model); MasterList.Add(model); }