private void RemoveHiddenEnemy(CommunicatableEnemyMarker marker) { hiddenEnemies.Remove(marker); EnemyMarkerStore.RemoveCommunicatorSubscriber(marker); marker.GetEnemyMarker().RemoveUser(this); }
private void AddHiddenEnemy(CommunicatableEnemyMarker marker) { hiddenEnemies.Add(marker); EnemyMarkerStore.AddCommunicatorSubscriber(marker); marker.GetEnemyMarker().AddUser(this); }
private bool NoMarkerTooCloseTo(CommunicatableEnemyMarker target) { Vector3 targetLocation = target.GetEnemyMarker().GetLocation(); foreach (CommunicatableEnemyMarker marker in hiddenEnemies) { Vector3 markerLocation = marker.GetEnemyMarker().GetLocation(); if (Vector3.Distance(markerLocation, targetLocation) < hiddenEnemyRadius) { return(false); } } return(true); }
public static void AddCommunicatorSubscriber(CommunicatableEnemyMarker communicator) { Integer communicators = null; EnemyMarker enemyMarker = communicator.GetEnemyMarker(); instance.enemyMarkers.TryGetValue(enemyMarker, out communicators); if (communicators == null) { instance.enemyMarkers.Add(enemyMarker, new Integer(0)); instance.enemyMarkersPublic.Add(enemyMarker); } Integer existingCommunicator = instance.enemyMarkers[enemyMarker]; existingCommunicator.value++; }
public static void RemoveCommunicatorSubscriber(CommunicatableEnemyMarker communicator) { Integer communicators = null; EnemyMarker enemyMarker = communicator.GetEnemyMarker(); instance.enemyMarkers.TryGetValue(enemyMarker, out communicators); if (communicators != null) { communicators.value--; if (communicators.value == 0) { instance.enemyMarkers.Remove(enemyMarker); instance.enemyMarkersPublic.Remove(enemyMarker); } } }