public void UseSkill(int job, int num, State _playerS, State[] targetsS) { playerS = _playerS; foreach (State _targetS in targetsS) { targetS = _targetS; SkillDelegate[job, num](); } playerS.Motion("SlashHand"); ColController.Instance.TurnEnd(); }
void RpcHookUpClient(GameObject _myHero) { myHero = _myHero; foreach (SkillMasterClass skill in myHero.GetComponentsInChildren <SkillMasterClass>()) { switch (skill.mySettings.skillButton) { case SkillSettings.Buttons.Q: QSkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.W: WSkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.E: ESkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.R: RSkill = skill.ExecuteSkill; break; } int mySkillIndex = NumFromButton(skill.mySettings.skillButton); skillSettings [mySkillIndex] = skill.mySettings; SkillCooldownDisplay.disps [mySkillIndex].cooldown = skillSettings [mySkillIndex].cooldown; } }
public IEnumerator Execute(SkillDelegate didStart = null, SkillDelegate didAction = null, SkillDelegate didEnd = null) { timeSinceSkillStart = 0; if (!SkillStart()) { yield break; } if (didStart != null) { didStart(); } sm.StartASkill(this); while (!SkillAction()) { if (didAction != null) { didAction(); } timeSinceSkillStart += Time.deltaTime; yield return(0); } SkillEnd(); if (didEnd != null) { didEnd(); } }
public PassiveSkill(Monster monster, SkillData data) { Owner = monster; skill = data; //get string of the name of the item string name = string.Concat(skill.name.Where(c => !char.IsWhiteSpace(c))); //convert string to a delegate to call the method of the name of the ability skillMethod = DelegateCreation(this, name); }
public Draven() { firstSkillName = "Draven1"; secondSkillName = "Draven2"; HealthPoint = 100; ManaPoint = 100; AttackPoint = 10; DefensePoint = 10; SkillDelegate s1 = new SkillDelegate(BasicAttack); SkillDelegate s2 = new SkillDelegate(FirstSkill); SkillDelegate s3 = new SkillDelegate(SecondSkill); Skills = new List <SkillDelegate>(); Skills.Add(s1); Skills.Add(s2); Skills.Add(s3); }
IEnumerator HookUpSkills() { while (true) { if (myHero != null && gameObject.activeSelf) { foreach (SkillMasterClass skill in GetComponent <PlayerSpawner>().myHero.GetComponentsInChildren <SkillMasterClass>()) { switch (skill.mySettings.skillButton) { case SkillSettings.Buttons.Q: QSkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.W: WSkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.E: ESkill = skill.ExecuteSkill; break; case SkillSettings.Buttons.R: RSkill = skill.ExecuteSkill; break; } int mySkillIndex = NumFromButton(skill.mySettings.skillButton); skillSettings [mySkillIndex] = skill.mySettings; SkillCooldownDisplay.disps [mySkillIndex].cooldown = skillSettings [mySkillIndex].cooldown; } RpcHookUpClient(myHero); break; } else { myHero = GetComponent <PlayerSpawner> ().myHero; yield return(0); } } }
SkillDelegate DelegateCreation(object target, string functionName) { SkillDelegate eq = (SkillDelegate)Delegate.CreateDelegate(typeof(SkillDelegate), target, functionName); return(eq); }