private void Awake() { this.trans = this.transform; this.ani = this.GetComponent <Animator>(); this.attacker = this.GetComponent <Attacker>(); this.scanEnemy = this.GetComponentInChildren <ScanEnemy>(); aiEnable = true; this.Walk = true; this.Running = false; }
public bool Cast(Attacker caster) { if (this.SkillType == SkillType.Target && caster.Target == null) { return(false); } if (caster.manaPoint.CurValue < this.Cost) { return(false); } if (this.castTime != 0 && this.castTime + this.CoolDown > UnityEngine.Time.time) { return(false); } this.castTime = UnityEngine.Time.time; caster.manaPoint.AddValue(-(int)this.Cost); int range = this.SkillType == SkillType.RangeShort?20:this.SkillType == SkillType.RangeMid?50:100; switch (this.SkillType) { case SkillType.Self: caster.OnSkillCast(this, caster); break; case SkillType.Target: caster.Target.OnSkillCast(this, caster); break; case SkillType.Both: caster.Target.OnSkillCast(this, caster); caster.OnSkillCast(this, caster); break; case SkillType.RangeShort: case SkillType.RangeMid: case SkillType.RangeLong: ScanEnemy se = caster.GetComponent <ScanEnemy>(); se.Enemies.ForEach((trans) => { trans.GetComponent <Attacker>().OnSkillCast(this, caster); }); break; default: break; } AddExp(Random.Range(5, 15)); return(true); }