コード例 #1
0
ファイル: Location.cs プロジェクト: StStep/ant-nest-sim
    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);
    }