Beispiel #1
0
    void UpdateVulnParameter()
    {
        AnimatorStateInfo nextState = anim.GetNextAnimatorStateInfo(0);

        if (!nextState.Equals(null) && nextState.IsName("Base Layer.Vulnerable"))
        {
            setVulnerability(false);
        }
    }
Beispiel #2
0
 public int GetCurrentState()
 {
     try {
         if (CurrentState == FLAG_STATE_DIE)
         {
             return(FLAG_STATE_DIE);
         }
         AnimatorStateInfo currentInfo = animator.GetCurrentAnimatorStateInfo(0);
         if (currentInfo.Equals(null))
         {
             return(0);
         }
         return((int)animationFlags [currentInfo.shortNameHash]);
     } catch (System.Exception e) {
         Debug.Log(e.Message);
     }
     return(0);
 }
Beispiel #3
0
    public override void ControllerUpdate()
    {
        base.ControllerUpdate();
        GrapplingHookControllerState state = this.m_State;

        if (state != GrapplingHookControllerState.SetupPosition)
        {
            if (state == GrapplingHookControllerState.ThrowHook)
            {
                AnimatorStateInfo currentAnimatorStateInfo = this.m_Animator.GetCurrentAnimatorStateInfo(0);
                if (!currentAnimatorStateInfo.Equals(null) && currentAnimatorStateInfo.normalizedTime > 0.8f)
                {
                    this.SetState(GrapplingHookControllerState.None);
                    this.StartLadder();
                }
            }
        }
        else
        {
            Vector3 a  = LadderController.GetPlayerWantedPos(this.m_Ladder, LadderControllerState.EnterDown);
            Vector3 a2 = LadderController.GetPlayerWantedDir(this.m_Ladder);
            if (a.magnitude < 0.1f || a2.magnitude < 0.1f)
            {
                this.Stop();
                return;
            }
            a  -= this.m_Player.gameObject.transform.position;
            a.y = 0f;
            a2 -= this.m_Player.gameObject.transform.forward;
            if (a.magnitude < 0.1f && a2.magnitude < 0.03f)
            {
                this.SetState(GrapplingHookControllerState.ThrowHook);
            }
        }
        this.UpdateLookDev();
    }