コード例 #1
0
    protected void CheckOneWayPlatformFallThrough()
    {
        if (_characterPhysicsManager.lastMoveCalculationResult.collisionState.below &&
            (_gameManager.inputStateManager.GetButtonState("Fall").buttonPressState & ButtonPressState.IsPressed) != 0 &&
            _playerController.currentPlatform != null &&
            _playerController.currentPlatform.layer == LayerMask.NameToLayer("OneWayPlatform"))
        {
            OneWayPlatform oneWayPlatform = _playerController.currentPlatform.GetComponent <OneWayPlatform>();

            Logger.Assert(oneWayPlatform != null, "OneWayPlatform " + _playerController.currentPlatform.name + " has no 'OneWayPlatform' script attached. This script is needed in order to allow the player to fall through.");

            if (oneWayPlatform != null)
            {
                oneWayPlatform.TriggerFall();
            }
        }
    }