public Scene(string[] map, int blockSize, Game game) { Game = game; var blocks = new List <Block>(); for (var i = 0; i < map.Length; i++) { for (var j = 0; j < map[i].Length; j++) { switch (map[i][j]) { case '#': blocks.Add(new Block(j * blockSize, i * blockSize, blockSize, blockSize)); break; case 'T': Actives.Add(new Turret(j * blockSize, i * blockSize, game)); break; case 'M': Actives.Add(new Tank( j * blockSize, i * blockSize, map[i][j + 1] == 'L' ? Direction.Left : Direction.Right, game)); j++; break; } } } LandScape = new Ground(map, blockSize); }
protected void InitSkillTree() { if (PlayerData.Class == CLASS.Warrior) { GameObject SkillTreeOJ; SkillTreeOJ = Resources.Load("SkillPrefabs/WarriorSkillTree") as GameObject; CachedTreeSkills = SkillTreeOJ.GetComponent <SkillTreeController>().SkillTree; } else if (PlayerData.Class == CLASS.Mage) { } else if (PlayerData.Class == CLASS.Rogue) { } for (int i = 0; i < Patch.SkillTreeSize; i++) { CachedTreeSkills[i].GenerateDescription(); if (CachedTreeSkills[i] != null && PlayerData.SkillTreelvls[i] != 0) //Does lvl+skill check here { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); if (s.GetType().IsSubclassOf(typeof(PassiveSkill))) { Passives.Add((PassiveSkill)s); } else { Actives.Add((ActiveSkill)s); } } } }
/// <summary> /// Handles the Checked event of the SearchEngineMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void SearchEngineMenuItemChecked(object sender, RoutedEventArgs e) { if (!Actives.Contains((sender as MenuItem).Tag as string)) { Actives.Add((sender as MenuItem).Tag as string); Settings.Set("Active Subtitle Sites", Actives); } }
public void Update() { foreach (var active in Actives) { active.Update(); } foreach (var active in ToAdd) { active.Update(); Actives.Add(active); } ToAdd = new List <IActive>(); }
protected void UpdateSkillTreeState() { for (int i = 0; i < Patch.SkillTreeSize; i++) { if (CachedTreeSkills[i].GetType().IsSubclassOf(typeof(ActiveSkill))) { ActiveSkill active = GetActive(CachedTreeSkills[i].GetType()); if (active && PlayerData.SkillTreelvls[i] != 0) { active.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); } else if (active && PlayerData.SkillTreelvls[i] == 0) { Actives.Remove(active); active.Delete(); } else if (active == null && PlayerData.SkillTreelvls[i] != 0) { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); Actives.Add((ActiveSkill)s); } } else { PassiveSkill passive = GetPassive(CachedTreeSkills[i].GetType()); if (passive && PlayerData.SkillTreelvls[i] != 0) { passive.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); } else if (passive && PlayerData.SkillTreelvls[i] == 0) { Passives.Remove(passive); passive.Delete(); } else if (passive == null && PlayerData.SkillTreelvls[i] != 0) { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); Passives.Add((PassiveSkill)s); } } } }