// Called when the police catches the player. private void OnPoliceCatchesPlayer(Police police) { if (OnPlayerCaught != null) { OnPlayerCaught(this); } }
// Spawn a police officer on this wall. public void SpawnPolice() { int ri = UnityEngine.Random.Range(0, policeSpawnPoints.Length); Transform spawn = policeSpawnPoints[ri]; Police police = Instantiate(Resources.Load <Police>("Prefabs/Police")); police.transform.SetParent(transform, false); police.transform.position = spawn.transform.position; police.OnCatchPlayer += OnPoliceCatchesPlayer; police.Activate(); ScheduleSpawnPolice(); }