EnemyCharacter.OnDisable C# (CSharp) Method

OnDisable() protected method

protected OnDisable ( ) : void
return void
    protected override void OnDisable()
    {
        // Inform our spawn source that we died. TODO: This is a slow operation; we really should cache
        // the list of spawn sources.
        if (sourceEnemySpawnID.HasValue)
        {
            SpawnPoint[] spawns = (SpawnPoint[])Object.FindObjectsOfType(typeof(SpawnPoint));
            foreach (SpawnPoint s in spawns)
            {
                if (s.SpawnID == sourceEnemySpawnID.Value)
                {
                    // Inform ourselves that the spawned enemy has died.
                    s.RPCSpawnedEnemyDied(networkView);
                }
            }
        }
        base.OnDisable();
    }