Esempio n. 1
0
    void Awake()
    {
        _controller            = GetComponent <CharacterController2D>();
        _dashAbility           = GetComponent <DashAbility>();
        _horizontalMoveAbility = GetComponent <HorizontalMoveAbility>();

        // listen to some events for illustration purposes
        //_controller.onControllerCollidedEvent += onControllerCollider;
        //_controller.onTriggerEnterEvent += onTriggerEnterEvent;
        _controller.onTriggerExitEvent += onTriggerExitEvent;
        _controller.onTriggerStayEvent += onTriggerStayEvent;

        if (airBreakThreshold <= airBreakSpeed)
        {
            throw new Exception("Airbreak Threshold must be higher than airbreak speed");
        }

        rb           = GetComponent <Rigidbody2D>();
        rb.sleepMode = RigidbodySleepMode2D.NeverSleep;
    }
Esempio n. 2
0
 void Awake()
 {
     _horizontalMoveAbility = GetComponent <HorizontalMoveAbility>();
     _controller            = GetComponent <CharacterController2D>();
 }