예제 #1
0
    public override void OnUpdate()
    {
        if (!m_IsDestroy)
        {
            beginTime += Time.deltaTime;
            if (beginTime > 6)
            {
                if (OnDestory != null)
                {
                    OnDestory();
                    m_IsDestroy = true;
                    return;
                }
            }
        }

        CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
        if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Die.ToString()))
        {
            CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)CurRoleFSMMgr.CurrentRoleStateEnum);
            if (CurAniamatorStateInfo.normalizedTime > 1)
            {
            }
        }
        else
        {
            CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
        }
    }
 public override void OnUpdate()
 {
     CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
     if (CurRoleFSMMgr.CurIdleType == IdleType.IdleNormal)
     {
         if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Idle_Normal.ToString()))
         {
             CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)RoleState.Idle);
         }
         else
         {
             CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
         }
     }
     if (CurRoleFSMMgr.CurIdleType == IdleType.IdleFight)
     {
         if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Idle_Fight.ToString()))
         {
             CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)RoleState.Idle);
         }
         else
         {
             CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
         }
     }
 }
예제 #3
0
 public override void OnUpdate()
 {
     CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
     if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Select.ToString()))
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)RoleState.Select);
         if (CheckPlayOneOver())
         {
             CurRoleFSMMgr.CurRoleCtrl.ToIdle(IdleType.IdleNormal);
         }
     }
     else
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
     }
 }
 public override void OnUpdate()
 {
     CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
     if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Hurt.ToString()))
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)CurRoleFSMMgr.CurrentRoleStateEnum);
         if (CurAniamatorStateInfo.normalizedTime > 1)
         {
             CurRoleFSMMgr.ChangeState(RoleState.Idle);
         }
     }
     else
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
     }
 }
예제 #5
0
 public override void OnUpdate()
 {
     CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
     if (CurAniamatorStateInfo.IsName(CurAnimatorName))
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), CurrentStateValue);
         if (CheckPlayOneOver())
         {
             Debug.Log("Attack Over");
             CurRoleFSMMgr.CurRoleCtrl.ToIdle(CurRoleFSMMgr.CurIdleType);
             CurRoleFSMMgr.CurRoleCtrl.IsRigibody = false;
         }
     }
     else
     {
         CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
     }
 }
예제 #6
0
    public override void OnUpdate()
    {
        if (Global.Instance.IsDeug)
        {
            CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
            if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Run.ToString()))
            {
                CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)CurRoleFSMMgr.CurrentRoleStateEnum);
            }
            else
            {
                CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
            }

            if (CurRoleFSMMgr.CurRoleCtrl.AstartPath == null)
            {
            }
            return;
        }
        //以上为测试代码
        CurAniamatorStateInfo = CurRoleFSMMgr.CurRoleCtrl.Animator.GetCurrentAnimatorStateInfo(0);
        //有可能在切换到Idle状态 期间 又切换到 Run 此时的动画是Idle 和 Run 的融合期 ,所以不会执行以下判断
        if (CurAniamatorStateInfo.IsName(RoleAniamtorName.Run.ToString()))
        {
            CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), (int)CurRoleFSMMgr.CurrentRoleStateEnum);
        }
        else
        {
            CurRoleFSMMgr.CurRoleCtrl.Animator.SetInteger(ToAnimatorCondition.CurrentState.ToString(), 0);
        }

        if (CurRoleFSMMgr.CurRoleCtrl.CurCharacterController == null)
        {
            return;
        }

        if (CurRoleFSMMgr.CurRoleCtrl.AstartPath == null)
        {
            //CurRoleFSMMgr.CurRoleCtrl.ToIdle(CurRoleFSMMgr.CurIdleType);
            return;
        }
        if (CurRoleFSMMgr.CurRoleCtrl.AstartWayPointIndex >= CurRoleFSMMgr.CurRoleCtrl.AstartPath.vectorPath.Count)
        {
            CurRoleFSMMgr.CurRoleCtrl.ToIdle(CurRoleFSMMgr.CurIdleType);
            return;
        }

        if (!CurRoleFSMMgr.CurRoleCtrl.CurCharacterController.isGrounded)
        {
            CurRoleFSMMgr.CurRoleCtrl.CurCharacterController.Move(Vector3.up * -1000 * Time.deltaTime);
        }

        Vector3 wayPoint   = CurRoleFSMMgr.CurRoleCtrl.AstartPath.vectorPath[CurRoleFSMMgr.CurRoleCtrl.AstartWayPointIndex];
        Vector3 tempTarget = new Vector3(wayPoint.x, CurRoleFSMMgr.CurRoleCtrl.transform.position.y, wayPoint.z);
        Vector3 dirction   = tempTarget - CurRoleFSMMgr.CurRoleCtrl.transform.position;

        if (CurRoleFSMMgr.CurRoleCtrl.RotateSpeed <= 1)
        {
            CurRoleFSMMgr.CurRoleCtrl.RotateSpeed += 5f;
        }
        Quaternion targetRotate = Quaternion.LookRotation(dirction);

        CurRoleFSMMgr.CurRoleCtrl.transform.rotation = Quaternion.Lerp(CurRoleFSMMgr.CurRoleCtrl.transform.rotation, targetRotate, Time.deltaTime * CurRoleFSMMgr.CurRoleCtrl.RotateSpeed);
        CurRoleFSMMgr.CurRoleCtrl.CurCharacterController.Move(dirction.normalized * CurRoleFSMMgr.CurRoleCtrl.MoveSpeed * Time.deltaTime);
        if ((CurRoleFSMMgr.CurRoleCtrl.transform.position - tempTarget).magnitude <= 0.6f)
        {
            CurRoleFSMMgr.CurRoleCtrl.AstartWayPointIndex++;
        }
    }