Example #1
0
    void Jump()
    {
        isJump = true;
        anim.SetTrigger("JumpWall");
        Flip.FlipIfCanFlip(inputDirection * -1);
        //   Flip.transform.localPosition = new Vector3(OffSetSpriteX * inputDirection.x * -1, Flip.transform.localPosition.y, Flip.transform.localPosition.z);
        Flip.transform.localPosition = new Vector3(OffSetSpriteX * 1 * -1, Flip.transform.localPosition.y, Flip.transform.localPosition.z);

        if (isChange)
        {
            StopCoroutine("ChangeStateMove");
            isChange = false;
        }
        canInputCheckWallJump = false;
        StartCoroutine(timerVar.StartTime(SetInputAgainTrue, InputForWallAgain));

        int dir = 0;

        if (isLeftSide)
        {
            dir = 1;
        }
        else
        {
            dir = -1;
        }
        if (useJump)
        {
            move.FirstJump(TimeNoInput, dir);
        }
        else
        {
            float multiplyX = 1.0f;
            if ((isLeftSide && inputDirection.x > 0) ||
                (isRigthSide && inputDirection.x < 0))
            {
                //  multiplyX = MultyplyForceOtherDireccion;
            }
            Vector2 normalFactorSpeed = FactorForNormalSpeed;
            if (move.canRun)
            {
                normalFactorSpeed = FactorForRunSpeed;
            }

            move.ApplyForce(new Vector2(dir, 1).normalized, force.x * multiplyX * normalFactorSpeed.x, force.y * normalFactorSpeed.y, true, TimeNoInput);

            move.SetIsNONWhenJump();
        }

        FX.Spawn(move.groundCheck.position);
        //Klvo
        jumpSFX.Play();
        fsm.PerformTransition(Transition.Move_WallJump);
    }
Example #2
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;
                }
            }
        }
    }