Example #1
0
 public override TaskStatus OnUpdate()
 {
     if (this._state == AvatarSkillState.Idle)
     {
         if (this._avatarActor.CanUseSkill(this.TriggerSkillName))
         {
             this.TryTriggerSkill();
             this._state = AvatarSkillState.WaitingForSkillStart;
             return(TaskStatus.Running);
         }
         this.SkillCD.SetValue(this.FailSetCD);
         return(TaskStatus.Failure);
     }
     if (this._state == AvatarSkillState.WaitingForSkillStart)
     {
         if (this._avatar.CurrentSkillID == this.SKillID)
         {
             this._state = AvatarSkillState.InSkill;
             return(TaskStatus.Running);
         }
         this._timer -= Time.deltaTime * this._avatar.TimeScale;
         if (this._timer < 0f)
         {
             this.SkillCD.SetValue(this.FailSetCD);
             return(TaskStatus.Failure);
         }
         this.TryTriggerSkill();
         return(TaskStatus.Running);
     }
     if (this._state == AvatarSkillState.InSkill)
     {
         if ((this._avatar.CurrentSkillID == this.SKillID) && (this._avatar.GetCurrentNormalizedTime() < this.NormalizedEndTime))
         {
             return(TaskStatus.Running);
         }
         this.SkillCD.SetValue(this.SuccessSetCD);
         return(TaskStatus.Success);
     }
     if (this._state == AvatarSkillState.BeHitCanceled)
     {
         this.SkillCD.SetValue(this.FailSetCD);
         return(TaskStatus.Failure);
     }
     return(TaskStatus.Failure);
 }
Example #2
0
 public override void OnStart()
 {
     this._state = AvatarSkillState.Idle;
     this._timer = this.RetryTimeOut;
     this._avatar.onBeHitCanceled = (Action <string>)Delegate.Combine(this._avatar.onBeHitCanceled, new Action <string>(this.AvatarBeHitCancelCallback));
 }
Example #3
0
 private void AvatarBeHitCancelCallback(string skillID)
 {
     this._state = AvatarSkillState.BeHitCanceled;
 }