void PoliceCarMode_Change() { if (difference >= 10 && difference <= 30) { Debug.Log("Mode Changing"); currentMode = PoliceCarMode.Aggressive; Invoke("PoliceCarMode_PreviousMode", 2.0f); } }
void OnEnable() { PoliceCar_Back(); thisTrans = transform; // coping the game object transform values in to a local value playercarScript = GameObject.FindGameObjectWithTag("Player").GetComponent <playerCarControl> (); currentState = PoliceCarState.OnRoad; // to start police car state on road currentMode = PoliceCarMode.Avoid; // to start police car with avid Mode PoliceCar_Back(); // InvokeRepeating("PoliceCarMode_Change", 10f, 20f); // police car mode changing here policeCarSound.volume = 0.3f; }
void PoliceCarMode_PreviousMode() { currentMode = PoliceCarMode.Avoid; }