private void AccessPoint_AccessPointAvailable(object sender, AccessPointAvailableEventArgs e) { if (e != null && e.removedNpc != null) { foreach(var npc in npcs) { if (npc.Type == e.removedNpc) { npc.Count--; break; } } } NpcAccessPoint accessPoint = sender as NpcAccessPoint; if (accessPoint != null) { if (!_availableAccessPoints.Contains(accessPoint)) { _availableAccessPoints.Add(accessPoint); } SpawnNpc(_availableAccessPoints[Random.Range(0, _availableAccessPoints.Count - 1)]); } }
private void OnAccessPointAvailable(AccessPointAvailableEventArgs args) { System.EventHandler<AccessPointAvailableEventArgs> handler = AccessPointAvailable; if (handler != null) { handler(this, args); } }