示例#1
0
 public override void Update()
 {
     base.Update();
     speed = 5;
     if (enemyPlayer)
     {
         GetComponent <Entity>().FaceObject(enemyPlayer);
     }
     vehicleControls.Accelerate();
 }
示例#2
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);
        }
    }
示例#3
0
 // Update is called once per frame
 void Update()
 {
     if (enemyTruck == null)
     {
         enemyTruck = GetEnemyTruck();
     }
     if (headElement.transform.position.x <= enemyTruck.GetComponent <Truck>().lastElement.transform.position.x)
     {
         myRigidbody.velocity = enemyTruck.GetComponent <Truck>().myRigidbody.velocity;
     }
     else
     {
         vehicleControls.Accelerate();
     }
 }
示例#4
0
 private void ManageDrivingBehavior()
 {
     if (driveBehavior == DriveBehavior.Idle)
     {
         vehicleControls.Idle();
     }
     else if (driveBehavior == DriveBehavior.Accelerate)
     {
         vehicleControls.Accelerate(acceleration);
     }
     else
     {
         vehicleControls.Brake();
     }
 }
示例#5
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();
        }
    }