public void RegisterSkillUnit(int ID, SkillUnit skillUnit) { if (dictSkillUnits.ContainsKey(ID)) { return; } dictSkillUnits.Add(ID, skillUnit); }
protected override void doStartHighEffect_Special() { Dictionary <DataType, object> dictionary = new Dictionary <DataType, object>(); string unit_id = this.data.unit_id; dictionary.Add(DataType.NameId, unit_id); dictionary.Add(DataType.TeamType, base.unit.teamType); UnitControlType unitControlType = UnitControlType.None; if (base.unit != null) { unitControlType = base.unit.unitControlType; } SkillUnit skillUnit = null; if (!Singleton <PvpManager> .Instance.IsInPvp) { skillUnit = (MapManager.Instance.SpawnSkillUnit(dictionary, null, base.unit.mTransform.position, Quaternion.identity, unitControlType, base.unit, this.skillId) as SkillUnit); } if (skillUnit != null) { skillUnit.unitControlType = base.unit.unitControlType; skillUnit.SetParentUnit(base.unit); skillUnit.UnitInit(false); string[] skillIDs = skillUnit.skillManager.GetSkillIDs(); string[] array = skillIDs; for (int i = 0; i < array.Length; i++) { string skillID = array[i]; skillUnit.skillManager.SetSkillLevel(skillID, base.unit.skillManager.GetSkillLevel(this.skillId)); } skillUnit.UnitStart(); Vector3?skillPosition = this.skillPosition; Vector3 arg_159_0; if (skillPosition.HasValue) { Vector3?skillPosition2 = this.skillPosition; arg_159_0 = skillPosition2.Value; } else { arg_159_0 = base.unit.mTransform.position; } Vector3 position = arg_159_0; BornUnitAction.SetPosition(skillUnit, this.targetUnits, base.unit, this.data, position); } this.Destroy(); }
private void apply_skills_to_hex_grid_map(SkillStruct ss) { foreach (KeyValuePair <string, SkillUnit> skill in ss.get_data()) { string skill_id = skill.Key; SkillUnit skill_data = skill.Value; int target_hexadrant = skill_data.hexadrant; List <int> hxds = new List <int>(); if (target_hexadrant == -1) { foreach (int k in radius_tiles[skill_data.radius].Keys) { hxds.Add(k); } } else { hxds.Add(target_hexadrant); } foreach (int hxd in hxds) { if (skill_data.bias_method == "border") { foreach (GameObject gt in get_all_tiles(skill_data.radius, hxd)) { HexGrid hg = gt.GetComponent <HexGrid>(); TextMesh tm = gt.GetComponentInChildren <TextMesh>(); hg.profession_border = true; colorize(gt, max_radius); tm.text = skill_data.skill_name; //hg.set_color(TileType.profession_border, max_radius); } } else { GameObject gt = get_available_tile(skill_data.radius, hxd); HexGrid hg = gt.GetComponent <HexGrid>(); TextMesh tm = gt.GetComponentInChildren <TextMesh>(); tm.text = skill_data.skill_name; //hg.set_color(TileType.preset_skill, max_radius); } } } }
public void Build() { string path = "Assets/Resources/Inits/SkillTiles.ini"; ss = new SkillStruct(); List <string> lines = new List <string>(File.ReadAllLines(path)); foreach (var line in lines) { if (line.Trim().Length == 0) { continue; } if (line[0] == '#') { continue; } var commasep = line.Split(','); string skill_id = commasep[0].Trim(); int radius = int.Parse(commasep[1].Trim()); string skill_name = commasep[2].Trim(); string bias_method = commasep[4].Trim(); int hexadrant = int.Parse(commasep[3].Trim()); List <string> preqs = new List <string>(); for (int i = 5; i < commasep.Length; i++) { preqs.Add(commasep[4].Trim()); } SkillUnit su = new SkillUnit(skill_name, radius, hexadrant, bias_method, preqs); ss.Add(skill_id, su); } }
public void Add(string id, SkillUnit su) { data.Add(id, su); }
public SkillUnitMoveNode(SkillUnit skillUnit, Vector3 targetPosition) { this.skillUnit = skillUnit; this.targetPosition = targetPosition; }