public void HitReactionAndFreeze(float freezeStTime, GrapplerType type)
 {
     if (HitReactCoroutine != null)
     {
         StopCoroutine(HitReactCoroutine);
     }
     HitReactCoroutine = StartCoroutine(_HitReactionAndFreeze(freezeStTime, type));
 }
Exemple #2
0
 public void Init(GrapplingSkill grapplingSkill, CharacterControl attacker)
 {
     Skill                  = grapplingSkill;
     IsRegistered           = false;
     IsFinished             = false;
     CurrentTargetNum       = 0;
     Type                   = grapplingSkill.Type;
     Mode                   = grapplingSkill.Mode;
     Range                  = grapplingSkill.Range;
     Damage                 = grapplingSkill.Damage;
     Stun                   = grapplingSkill.Stun;
     FreezeStartTiming      = grapplingSkill.FreezeStartTiming;
     Attacker               = attacker;
     Target                 = null;
     CheckCompleteCoroutine = null;
 }
        IEnumerator _HitReactionAndFreeze(float freezeStTime, GrapplerType type)
        {
            //this.CharacterData.GetHitTime = 0.5f;
            //int randomIndex = Random.Range (0, 3) + 1;
            //int randomIndex = 1;
            if (type == GrapplerType.FrontStab)
            {
                this.Animator.Play("GrapplingHitFrontStab", 0, 0f);
            }
            else if (type == GrapplerType.DownStab)
            {
                if (this.CharacterData.IsStunned)
                {
                    this.Animator.Play("GrapplingHitDownStabStunned", 0, 0f);
                }
                else
                {
                    this.Animator.Play("GrapplingHitDownStab", 0, 0f);
                }
            }

            float t = 0f;

            while (true)
            {
                if (t > freezeStTime)
                {
                    /*
                     * if (t > freezeStTime && t <= freezeStTime + freezeTime) {
                     *      this.Animator.SetFloat (TransitionParameter.SpeedMultiplier.ToString (), 0f);
                     *  if (t > freezeStTime + freezeTime) {
                     */
                    this.Animator.SetFloat(TransitionParameter.SpeedMultiplier.ToString(), 0f);
                    yield break;
                }
                t = t + Time.deltaTime;
                //this.CharacterData.GetHitTime = 0.5f;
                yield return(null);
            }
        }