예제 #1
0
    private void ManageVehicleControls(float xMovement, float yMovement)
    {
        if ((xMovement != 0 || yMovement != 0) && IsInExMode())
        {
            vehicleControls.speedMultiplier = 1.5f;
        }
        else
        {
            vehicleControls.speedMultiplier = 1;
        }

        if (xMovement < 0)
        {
            vehicleControls.Brake();
        }
        if (yMovement != 0)
        {
            vehicleControls.Steer(yMovement);
        }
        else
        {
            vehicleControls.Straight();

            if (xMovement > 0)
            {
                vehicleControls.Accelerate();
            }
            else
            {
                vehicleControls.Idle();
            }
        }

        if ((transform.position.x <= gameMarker.transform.position.x - 13.5f) && myRigidbody.velocity.x < gameMarker.GetComponent <GameMarker>().myRigidbody.velocity.x)
        {
            myRigidbody.velocity = new Vector3(gameMarker.GetComponent <GameMarker>().myRigidbody.velocity.x * 1.05f, myRigidbody.velocity.y);
        }

        if ((transform.position.x >= gameMarker.transform.position.x + 13.5f) && myRigidbody.velocity.x > gameMarker.GetComponent <GameMarker>().myRigidbody.velocity.x)
        {
            myRigidbody.velocity = new Vector3(gameMarker.GetComponent <GameMarker>().myRigidbody.velocity.x * .99f, myRigidbody.velocity.y);
        }

        if ((transform.position.y <= gameMarker.transform.position.y - 6.5) && myRigidbody.velocity.y < 0)
        {
            myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, -myRigidbody.velocity.y, 0);
        }

        if ((transform.position.y >= gameMarker.transform.position.y + 6.5) && myRigidbody.velocity.y > 0)
        {
            myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, -myRigidbody.velocity.y, 0);
        }
    }
예제 #2
0
 private void ManageDrivingBehavior()
 {
     if (driveBehavior == DriveBehavior.Idle)
     {
         vehicleControls.Idle();
     }
     else if (driveBehavior == DriveBehavior.Accelerate)
     {
         vehicleControls.Accelerate(acceleration);
     }
     else
     {
         vehicleControls.Brake();
     }
 }
예제 #3
0
    private void ManageDrivingBehavior()
    {
        if (currentStartupTime < maxStartupTime)
        {
            vehicleControls.Steer(0.25f * reverseFactor);
        }
        else
        {
            vehicleControls.Straight();
        }

        if (driveBehavior == DriveBehavior.Idle)
        {
            vehicleControls.Idle();
        }
        else if (driveBehavior == DriveBehavior.Accelerate)
        {
            vehicleControls.Accelerate(acceleration);
        }
        else
        {
            vehicleControls.Brake();
        }
    }