Example #1
0
    public void Accept(Ant ant)
    {
        // If this is the destination location, handle ant
        if (ant.destination == this)
        {
            LetVisit(ant);
            return;
        }

        // Find which path to place ant
        Route bestRoute = NetworkManager.instance.LocationNetwork.GetRoute(this, ant.destination);

        if (bestRoute == null)
        {
            Debug.Log("Location ID " + this.LocID + ": No route found to location ID " + ant.destination.LocID);
            return;
        }

        //Index 1 would be the next location the ant should go
        Path nextPath = _connectedPaths[bestRoute[1].LocID];

        if (nextPath == null)
        {
            Debug.Log("Location ID " + this.LocID + ": No path found to location ID " + ant.destination.LocID);
            return;
        }

        nextPath.AcceptFrom(this, ant);
    }