Example #1
0
    private void RemoveHiddenEnemy(CommunicatableEnemyMarker marker)
    {
        hiddenEnemies.Remove(marker);
        EnemyMarkerStore.RemoveCommunicatorSubscriber(marker);

        marker.GetEnemyMarker().RemoveUser(this);
    }
Example #2
0
    private void AddHiddenEnemy(CommunicatableEnemyMarker marker)
    {
        hiddenEnemies.Add(marker);
        EnemyMarkerStore.AddCommunicatorSubscriber(marker);

        marker.GetEnemyMarker().AddUser(this);
    }
Example #3
0
    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);
    }
Example #4
0
    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++;
    }
Example #5
0
    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);
            }
        }
    }