Exemplo n.º 1
0
    IEnumerator StandEnum(StateManager_Mech MyManager)
    {
        CapsuleCollider body = GetComponent <CapsuleCollider>();

        //SetRunForce(75);
        yield return(null);

        while (MyManager.GetPlayerStance().ToString() == "Standing" && body.height < playerStanding)
        {
            body.height += turnSpeed * Time.deltaTime;
            if (body.height > playerStanding)
            {
                if (MyManager.GetPlayerState().ToString() == "Sprinting")
                {
                    SetRunForce(AutomaticForce);
                    bobbingSpeed = 0.25f;
                }
                else
                {
                    SetRunForce(ManualForce);
                    bobbingSpeed = .18f;
                }
            }
            yield return(null);
        }
    }
Exemplo n.º 2
0
    IEnumerator CrouchEnum(StateManager_Mech MyManager)
    {
        CapsuleCollider body = GetComponent <CapsuleCollider>();

        if (MyManager.GetPlayerStance().ToString() == "Crouching" && MyManager.GetPlayerState().ToString() != "Sliding" && MyManager.IsOnGround())
        {
            SetRunForce(CrouchForce);
            bobbingSpeed = 0.13f;
        }
        yield return(null);

        while (MyManager.GetPlayerStance().ToString() == "Crouching" && body.height > playerCrouch)
        {
            if (runForce > 50 && MyManager.GetPlayerState().ToString() != "Sliding" && MyManager.IsOnGround())
            {
                SetRunForce(CrouchForce);
            }
            body.height -= turnSpeed * Time.deltaTime;
            yield return(null);
        }
    }
Exemplo n.º 3
0
    IEnumerator SlideEnum(Rigidbody myRigidBody, StateManager_Mech MyManager, Vector3 DesiredDirection)
    {
        //Debug.Log("Ping");
        SetRunForce(50);
        slideDirection       = new Vector3(myRigidBody.velocity.x, 0.0f, myRigidBody.velocity.z);
        myRigidBody.velocity = Vector3.zero;

        Debug.DrawRay(transform.position + Vector3.up, slideDirection * 100, Color.blue);
        myRigidBody.AddForce(slideDirection * slideForce);
        yield return(null);

        float currentForce = slideForce / 5;

        while (MyManager.GetPlayerState().ToString() == "Sliding" && currentForce > 0)
        {
            // Debug.Log("Pong");
            myRigidBody.AddForce(slideDirection * currentForce);
            currentForce -= slideDecayRate * Time.deltaTime;
            yield return(null);
        }
    }