Esempio n. 1
0
        void ProcessMovementArea()
        {
            if (!isAffectedByMovementAreas)
            {
                return;
            }

            if (characterController2D.CollidedTrigger == null)
            {
                collidedTrigger = null;
                RevertMovementParameters();
                return;
            }
            else
            {
                if ((collidedTrigger == null) ||
                    (characterController2D.CollidedTrigger != collidedTrigger))
                {
                    MovementArea movementArea = characterController2D.CollidedTrigger.GetComponent <MovementArea>();
                    if (movementArea != null)
                    {
                        SetMovementParameters(movementArea);
                    }

                    collidedTrigger = characterController2D.CollidedTrigger;
                }
            }
        }
Esempio n. 2
0
        void SetMovementParameters(MovementArea movementArea)
        {
            CharacterMovementProfile data = movementArea.CharacterMovementData;

            if (data == null)
            {
                return;
            }

            if (data.horizontalMovementData != null)
            {
                this.horizontalData = data.horizontalMovementData;

                characterController2D.SetVelocityX(characterController2D.Velocity.x * data.horizontalMovementData.entrySpeedFactor);
            }
        }
Esempio n. 3
0
        void SetMovementParameters(MovementArea movementArea)
        {
            CharacterMovementProfile data = movementArea.CharacterMovementData;

            if (data == null)
            {
                return;
            }

            if (data.verticalMovementData != null)
            {
                this.verticalData = data.verticalMovementData;
                CalculateGravityParameters();

                characterController2D.SetVelocityY(characterController2D.Velocity.y * data.verticalMovementData.entrySpeedMultiplier);
            }
        }