예제 #1
0
    private void AcceleratorScale()
    {
        if ((Mathf.Abs(velocity.x) < Mathf.Abs(velocity_endgoal.x) && Mathf.Sign(velocity.x) == Mathf.Sign(velocity_endgoal.x)) ||
            accelerator_x == 0)
        {
            Universals.LerpBetter(accelerator_x, 1f, acceleration_true * Time.deltaTime);
        }
        else
        {
            Universals.LerpBetter(accelerator_x, 0, acceleration_true * Time.deltaTime);
        }

        if ((Mathf.Abs(velocity.y) < Mathf.Abs(velocity_endgoal.y) && Mathf.Sign(velocity.y) == Mathf.Sign(velocity_endgoal.y)) ||
            accelerator_y == 0)
        {
            Universals.LerpBetter(accelerator_y, 1f, acceleration_true * Time.deltaTime);
        }
        else
        {
            Universals.LerpBetter(accelerator_y, 0, acceleration_true * Time.deltaTime);
        }

        if ((Mathf.Abs(velocity.z) < Mathf.Abs(velocity_endgoal.z) && Mathf.Sign(velocity.z) == Mathf.Sign(velocity_endgoal.z)) ||
            accelerator_z == 0)
        {
            Universals.LerpBetter(accelerator_z, 1f, acceleration_true * Time.deltaTime);
        }
        else
        {
            Universals.LerpBetter(accelerator_z, 0, acceleration_true * Time.deltaTime);
        }
    }
예제 #2
0
    private void MovementLerpUnifiedXZ()
    {
        //Debug.Log(velocity_endgoal);

        float ratio;

        if (Mathf.Abs(velocity_endgoal.x - velocity.x)
            > Mathf.Abs(velocity_endgoal.z - velocity.z))
        {
            ratio      = Mathf.Abs(velocity_endgoal.z - velocity.z) / Mathf.Abs(velocity_endgoal.x - velocity.x);
            velocity.x = Universals.LerpBetter(velocity.x, velocity_endgoal.x, acceleration_true * Universals.GetTimeFake());
            velocity.z = Universals.LerpBetter(velocity.z, velocity_endgoal.z, acceleration_true * ratio * Universals.GetTimeFake());
        }
        else
        {
            ratio      = Mathf.Abs(velocity_endgoal.x - velocity.x) / Mathf.Abs(velocity_endgoal.z - velocity.z);
            velocity.z = Universals.LerpBetter(velocity.z, velocity_endgoal.z, acceleration_true * Universals.GetTimeFake());
            velocity.x = Universals.LerpBetter(velocity.x, velocity_endgoal.x, acceleration_true * ratio * Universals.GetTimeFake());
        }
    }
예제 #3
0
    public override void DoOnUpdate()
    {
        base.DoOnUpdate();

        if (Time.timeScale > 0.1f)
        {
            lean_goal = LeanGoalGenerate();

            lean.z = Universals.LerpBetter(lean.z, lean_goal, lean_speed_scalar * Time.deltaTime);

            LeanSet();

            //MovementLean();

            //ControlLean();

            CycaBlyat();
        }

        RecordPosRotData();
    }
예제 #4
0
 private void MovementLerpY()
 {
     velocity.y = Universals.LerpBetter(velocity.y, velocity_endgoal.y, acceleration * Time.deltaTime);
 }