public static Quest GetQuests(QuestsEnum quests) { switch (quests) { case QuestsEnum.Money10: return(new Quest(QuestType.money, "Money 10", 10)); case QuestsEnum.Money20: return(new Quest(QuestType.money, "Money 20", 20)); case QuestsEnum.Money30: return(new Quest(QuestType.money, "Money 30", 30)); case QuestsEnum.Level1: return(new Quest(QuestType.level, "Level 1", 1)); case QuestsEnum.Level2: return(new Quest(QuestType.level, "Level 2", 2)); case QuestsEnum.Level3: return(new Quest(QuestType.level, "Level 3", 3)); case QuestsEnum.GeorgeLevel2: return(new Quest(QuestType.playerLevel, "George Level 2", 2, "George")); } return(null); }
/// <summary> /// Ensure all quests are unqiue and then load main level /// </summary> public void startGame() { bool success = true; for (int i = 0; i < questDropdowns.Length; i++) { QuestsEnum questsEnum = ((QuestsEnum)questDropdowns[i].value); Quest quest = Quests.GetQuests(questsEnum); for (int j = 0; j < quests.Count; j++) { if (quests[j].Name == quest.Name) { success = false; } } quests.Add(quest); } if (success) { //Load level PlayerData.instance.data = new DataManager( new Player("George", 1, 100, 5, 5, 5, 5, 5, 5, 0, null, new MagicAttack("hi-jump kicked", "Kick with power 15", 3, 15), new RaiseDefence("buffed up against", "Increase your defence by 10%", 2, 0.1f), (Texture2D)Resources.Load("Character1", typeof(Texture2D)))); PlayerData.instance.data.addPlayer(new Player("Hannah", 1, 100, 5, 3, 5, 5, 15, 5, 0, null, new IncreaseMoney("stole money from", "Increase money returns by 50%", 2, 0.5f), new MagicAttack("threw wine battles at", "Throw wine bottles with damage 15", 2, 15), (Texture2D)Resources.Load("Character2", typeof(Texture2D)))); GlobalFunctions.instance.currentLevel = 0; GlobalFunctions.instance.objectsActive = new Dictionary <string, bool>(); setQuests(); SoundManager.instance.playSFX("interact"); player.SetActive(true); SceneChanger.instance.loadLevel("CS-Jail", new Vector2(0, 0)); } else { quests = new List <Quest>(); } }