コード例 #1
0
 // Called when the police catches the player.
 private void OnPoliceCatchesPlayer(Police police)
 {
     if (OnPlayerCaught != null)
     {
         OnPlayerCaught(this);
     }
 }
コード例 #2
0
        // 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();
        }