コード例 #1
0
ファイル: LedgeHanging.cs プロジェクト: Hengle/Test
        public override void UpdateBehaviour(float dt)
        {
            // bool isTag = CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).tagHash == StateNameHash;

            switch (state)
            {
            case LedgeHangingState.Idle:

                if (CharacterActions.movement.Up || autoClimbUp || forceAutoClimbUp)
                {
                    state = LedgeHangingState.TopUp;
                    CharacterStateController.UseRootMotion = true;
                    CharacterStateController.Animator.SetTrigger(topUpParameter);
                }
                else if (CharacterActions.movement.Down)
                {
                    forceExit = true;
                }

                break;

            case LedgeHangingState.TopUp:

                if (CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).IsName("Exit"))
                {
                    forceExit = true;
                    CharacterActor.ForceGrounded();
                }


                break;
            }
        }
コード例 #2
0
ファイル: LadderClimbing.cs プロジェクト: nicorivas/game1
        public override void UpdateBehaviour(float dt)
        {
            switch (state)
            {
            case LadderClimbState.Entering:

                CharacterActor.Position = targetPosition;
                CharacterStateController.UseRootMotion = true;
                CharacterStateController.Animator.SetTrigger(isBottom ? bottomUpParameter : topDownParameter);

                state = LadderClimbState.AnimationBased;

                break;

            case LadderClimbState.AnimationBased:

                if (CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
                {
                    if (CharacterActions.interact.Started)
                    {
                        forceExit = true;
                    }
                    else
                    {
                        if (CharacterActions.movement.Up)
                        {
                            if (currentClimbingAnimation == currentLadder.ClimbingAnimations)
                            {
                                CharacterStateController.Animator.SetTrigger(topUpParameter);
                            }
                            else
                            {
                                CharacterStateController.Animator.SetTrigger(upParameter);
                                currentClimbingAnimation++;
                            }
                        }
                        else if (CharacterActions.movement.Down)
                        {
                            if (currentClimbingAnimation == 0)
                            {
                                CharacterStateController.Animator.SetTrigger(bottomDownParameter);
                            }
                            else
                            {
                                CharacterStateController.Animator.SetTrigger(downParameter);
                                currentClimbingAnimation--;
                            }
                        }
                    }
                }
                else if (CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).IsName("Entry"))
                {
                    forceExit = true;
                    CharacterActor.ForceGrounded();
                }

                break;
            }
        }
コード例 #3
0
ファイル: LedgeHanging.cs プロジェクト: nicorivas/game1
        public override void UpdateBehaviour(float dt)
        {
            bool isTag = CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).tagHash == StateNameHash;


            switch (state)
            {
            // case LedgeHangingState.Entering:


            //     CharacterActor.Position = targetPosition;
            //     CharacterStateController.UseRootMotion = true;
            //     state = LedgeHangingState.Idle;

            //     break;

            // // case LedgeHangingState.WaitingForAnimator:


            // //     // The transition has ended.
            // //     if( isTag )
            // //     {


            // //     }

            // //     break;

            case LedgeHangingState.Idle:

                if (CharacterActions.movement.Up || autoClimbUp || forceAutoClimbUp)
                {
                    state = LedgeHangingState.TopUp;
                    CharacterStateController.UseRootMotion = true;
                    CharacterStateController.Animator.SetTrigger(topUpParameter);
                }
                else if (CharacterActions.movement.Down)
                {
                    forceExit = true;
                }

                break;

            case LedgeHangingState.TopUp:

                // CharacterStateController.Animator.MatchTarget( ( leftHitInfo.point + rightHitInfo.point ) / 2f , AvatarTarget.Root , 0.7f , 0.95f );

                if (CharacterStateController.Animator.GetCurrentAnimatorStateInfo(0).IsName("Exit"))
                {
                    forceExit = true;
                    CharacterActor.ForceGrounded();
                }

                // if( !isTag )
                // {
                //     forceExit = true;
                //     CharacterActor.ForceGrounded();
                // }


                break;
            }
        }