// ========================================================================== //

    /* protected - Override & Unity API         */

    protected override void OnAwake()
    {
        base.OnAwake();

        _pCharacterController = GetComponent <CCharacterController2D>();
        _pCharacterController.EventOnAwake();
    }
    // ==================================================================================================

    protected override void OnInit(CCharacterController2D pCharacterController2D)
    {
        base.OnInit(pCharacterController2D);

        _pColliderGround = pCharacterController2D.p_pCollider_GroundChecker;
        _sLayerTerrain   = pCharacterController2D.p_sWhatIsTerrain;
    }
예제 #3
0
    private void Start()
    {
        _characterController = this.GetComponent <CCharacterController2D>();

        // calculate gravity
        _gravity = -(2 * _jumpHeight) / Mathf.Pow(_timeToJumpApex, 2);

        // calculate jump velocity needed to reach the jump
        _jumpVelocity = Mathf.Abs(_gravity) * _timeToJumpApex;
    }
예제 #4
0
    // ========================================================================== //

    protected override void OnInit(CCharacterController2D pCharacterController2D)
    {
        base.OnInit(pCharacterController2D);

        _bLockClimb        = false;
        p_pCollider_Ladder = null;
        p_bIsClimbLadder   = false;

        _pCharacterController2D.p_Event_OnGround.Subscribe += OnGround;
    }
    // ========================================================================== //

    protected override void OnInit(CCharacterController2D pCharacterController2D)
    {
        base.OnInit(pCharacterController2D);

        pCharacterController2D.p_Event_OnGround.Subscribe      += OnResetJumpCount;
        pCharacterController2D.p_Event_OnLadder.Subscribe      += OnResetJumpCount;
        pCharacterController2D.p_Event_OnWallSliding.Subscribe += OnSet_JumpCount_IsOne;
        pCharacterController2D.p_Event_OnFalling.Subscribe     += OnFalling;

        _iCurrentMultipleJumpCount = 0;
    }
예제 #6
0
    public void DoInit(CCharacterController2D pCharacterController2D, CCharacterController2D_MoveLogicBase pMoveLogic, CCharacterController2D_LadderLogicBase pLadderLogic)
    {
        _pCharacterController2D = pCharacterController2D;
        rigidbody = _pCharacterController2D.p_pRigidbody;
        transform = _pCharacterController2D.transform;

        _pMoveLogic   = pMoveLogic;
        _pLadderLogic = pLadderLogic;

        OnInit(pCharacterController2D);
    }
예제 #7
0
 protected virtual void OnInit(CCharacterController2D pCharacterController2D)
 {
 }