Beispiel #1
0
        /**
         * The Player's "Update" function, called by StateHandler.
         */
        public override void _Update()
        {
            bool jumped = false;

            if (KickStarter.playerInput.InputGetButtonDown("Jump") && KickStarter.stateHandler.IsInGameplay() && motionControl == MotionControl.Automatic && !KickStarter.stateHandler.MovementIsOff)
            {
                if (!KickStarter.playerInput.IsJumpLocked)
                {
                    jumped = Jump();
                }
            }

            if (hotspotDetector)
            {
                hotspotDetector._Update();
            }

            if (activePath && !pausePath)
            {
                if (IsTurningBeforeWalking())
                {
                    if (charState == CharState.Move)
                    {
                        StartDecelerating();
                    }
                    else if (charState == CharState.Custom)
                    {
                        charState = CharState.Idle;
                    }
                }
                else if ((KickStarter.stateHandler.gameState == GameState.Cutscene && !lockedPath) ||
                         (KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) ||
                         (KickStarter.settingsManager.movementMethod == MovementMethod.None) ||
                         (KickStarter.settingsManager.movementMethod == MovementMethod.StraightToCursor && KickStarter.settingsManager.singleTapStraight) ||
                         IsMovingToHotspot())
                {
                    charState = CharState.Move;
                }
            }
            else if (activePath == null && charState == CharState.Move && !KickStarter.stateHandler.IsInGameplay() && KickStarter.stateHandler.gameState != GameState.Paused)
            {
                StartDecelerating();
            }

            if (isJumping && !jumped)
            {
                if (IsGrounded())
                {
                    isJumping = false;
                }
            }

            base._Update();
        }
Beispiel #2
0
        private void Update()
        {
            if (KickStarter.stateHandler && KickStarter.stateHandler.playerIsOff)
            {
                return;
            }

            if (hotspotDetector)
            {
                hotspotDetector._Update();
            }

            _Update();
        }
Beispiel #3
0
        /**
         * The Player's "Update" function, called by StateHandler.
         */
        public override void _Update()
        {
            bool jumped = false;

            if (KickStarter.playerInput.InputGetButtonDown("Jump") && KickStarter.stateHandler.gameState == GameState.Normal && motionControl == MotionControl.Automatic)
            {
                if (!KickStarter.playerInput.IsJumpLocked)
                {
                    jumped = Jump();
                }
            }

            if (hotspotDetector)
            {
                hotspotDetector._Update();
            }

            if (activePath && !pausePath)
            {
                if (IsTurningBeforeWalking())
                {
                    if (charState == CharState.Move)
                    {
                        charState = CharState.Decelerate;
                    }
                    else if (charState == CharState.Custom)
                    {
                        charState = CharState.Idle;
                    }
                }
                else if ((KickStarter.stateHandler && KickStarter.stateHandler.gameState == GameState.Cutscene && !lockedPath) ||
                         (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) ||
                         (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.StraightToCursor && KickStarter.settingsManager.singleTapStraight) ||
                         IsMovingToHotspot())
                {
                    charState = CharState.Move;
                }

                if (!lockedPath)
                {
                    CheckIfStuck();
                }
            }
            else if (activePath == null && (KickStarter.stateHandler.gameState == GameState.Cutscene || KickStarter.stateHandler.gameState == GameState.DialogOptions) && charState == CharState.Move)
            {
                charState = CharState.Decelerate;
            }

            if (isJumping && !jumped)
            {
                if (IsGrounded())
                {
                    isJumping = false;
                }
            }

            if (isTilting)
            {
                actualTilt = Mathf.Lerp(actualTilt, targetTilt, AdvGame.Interpolate(tiltStartTime, tiltSpeed, MoveMethod.Smooth, null));
                if (Mathf.Abs(targetTilt - actualTilt) < 2f)
                {
                    isTilting = false;
                }
            }

            base._Update();

            if (isTilting)
            {
                UpdateTilt();
            }
        }