예제 #1
0
    /// <summary>
    /// Disable the Car
    /// </summary>
    protected override void DisableCar()
    {
        //Call Base Function
        base.DisableCar();

        if (carAIChase)
        {
            carAIChase.enabled = false;
        }

        //Set the inputs of the car to 0 so it stops
        if (controllingCar)
        {
            controllingCar.CarSteerInput      = 0f;
            controllingCar.CarAccelerateInput = 0f;
        }


        //Remove as an active car
        CarDisabled?.Invoke(this);

        //Set an coroutine to destroy this object when it is out of view
        Destroy(gameObject, despawnTime);
    }
예제 #2
0
 private void OnDestroy()
 {
     CarDisabled?.Invoke(this);
 }