private static void ExecuteSkillImpl(BinaryReader reader) { int attackerId = reader.ReadInt32(); int targetId = reader.ReadInt32(); int skillId = reader.ReadInt32(); Debug.Log(string.Format("Attacker [{0}] Used skill [{1}] on target [{2}]", attackerId, skillId, targetId)); Character attacker = CharactersManager.Instance.GetPlayer(attackerId); if (attacker != null) { attacker.LastTargetId = targetId; SkillDataHandler data = SkillsManager.Instance.GetSkillData(skillId); if (data == null) { Debug.LogError("No skill data found: " + skillId); return; } var director = attacker.GetComponentInChildren <PlayableDirector>(); director.time = 0; director.Play(data.animationClip); } }
public bool GetSkillData(int id, out SkillDataHandler skillData) { SkillDataHandler handler = skills.Find(s => s.id == id); skillData = handler; return(handler != null); }
private void Instance_OnLocalPlayerChanged(Character obj) { List <SkillDataHandler> classSkills = SkillsManager.Instance.GetSkillsForClass((Class)obj.Data.@class); SkillButton[] bts = GetComponentsInChildren <SkillButton>(); for (int i = 0; i < bts.Length; i++) { SkillDataHandler handler = classSkills[i]; bts[i].Fill(classSkills[i].id); var draggable = bts[i].GetComponentInChildren <DraggableButton>(); draggable.OnHover.AddListener(delegate { FillSkillHoverWithSkillData(handler); }); draggable.OnExitHover.AddListener(delegate { skillHoverController.GetComponent <UIPanel>().Deactivate(); }); } }
public void Fill(SkillDataHandler skillData) { this.nameText.text = skillData.name; this.descriptionText.text = skillData.description; this.reqLvlText.text = skillData.reqLvl.ToString(); }
public void FillSkillHoverWithSkillData(SkillDataHandler skillData) { skillHoverController.Fill(skillData); uiPanelSkillHoverController.Activate(); }