Beispiel #1
0
    protected override void Reason()
    {
        if (!ManagerPause.Pause && !isForcing)
        {
            if (Physics2D.OverlapCircleNonAlloc(HeadCheck.position, groundRadiusTotal, result, layerLadder) <= 0)
            {            //Fix Loco
                for (int i = 0; i < result.Length; ++i)
                {
                    if (result[i] != null)
                    {
                        if (result[i] == move.LadderTop)
                        {
                            if (buttonMapAxis[VerticalAxis] > 0f)
                            {
                                isForcing             = true;
                                _rigidbody2D.velocity = Vector2.zero;
                                anim.SetTrigger(AnimLadderTRigerJump);

                                twen = transform.DOMoveY(move.LadderPosTop.position.y, timetoChangeAfterImpulse).OnComplete(OnCompleteMove);

                                //      StartCoroutine("ChangeToMove", timetoChangeAfterImpulse);
                            }
                            break;
                        }
                    }
                }
            }
            if (!isForcing)
            {
                if (move.PressJump && buttonMapAxis[VerticalAxis] < 0.5f && buttonMapAxis[VerticalAxis] > -0.5f)
                {
                    move.CloseLadderState();
                    move.FirstJump(0, 0, true);
                    timevar.StartTimer(move.OpenLadderState, 0.2f);
                    fsm.PerformTransition(Transition.Move_Ladder);
                    return;
                }
                move.CheckForceOutLadder();
                if (!move.canLadder)
                {
                    fsm.PerformTransition(Transition.Move_Ladder);
                    return;
                }
            }
        }
    }