// Add a section from an ini file to the quest data. Duplicates are not allowed void AddData(string name, Dictionary <string, string> content, string path) { // Fatal error on duplicates if (components.ContainsKey(name)) { Debug.Log("Duplicate component in quest: " + name); Application.Quit(); } // Quest is a special component if (name.Equals("Quest")) { quest = new Quest(content); } // Check for known types and create if (name.IndexOf(Tile.type) == 0) { Tile c = new Tile(name, content); components.Add(name, c); } if (name.IndexOf(Door.type) == 0) { Door c = new Door(name, content, game); components.Add(name, c); } if (name.IndexOf(Token.type) == 0) { Token c = new Token(name, content, game); components.Add(name, c); } if (name.IndexOf(Event.type) == 0) { Event c = new Event(name, content); components.Add(name, c); } if (name.IndexOf(Monster.type) == 0) { Monster c = new Monster(name, content, game); components.Add(name, c); } if (name.IndexOf(MPlace.type) == 0) { MPlace c = new MPlace(name, content); components.Add(name, c); } if (name.IndexOf("UniqueMonster") == 0) { UniqueMonster c = new UniqueMonster(name, content, path); components.Add(name, c); } if (name.IndexOf("Activation") == 0) { Activation c = new Activation(name, content); components.Add(name, c); } // If not known ignore }
static void Main(string[] args) { var skeleton = new RegularMonster("Skeleton", 1, 10, new Mutator[] { new NoMutator("No mutator") }); var goblin = new RegularMonster("Goblin", 2, 15, new Mutator[] { new AuraMutator("Frost Aura") }); var helish = new UniqueMonster("Helish", 2, 25, new Mutator[] { new AuraMutator("Flame Aura"), new TeleportationMutator("Teleportation Mutator") }); Console.WriteLine(skeleton.GetDescription()); Console.WriteLine(goblin.GetDescription()); Console.WriteLine(helish.GetDescription()); }