예제 #1
0
    public void AddAntToRoad(Waypoint w1, Waypoint w2)
    {
        if (w1 == null)
        {
            Debug.Log("Waypoint1 null in AddAntToRoad in FlowManager");
            return;
        }
        if (w2 == null)
        {
            Debug.Log("Waypoint2 null in AddAntToRoad in FlowManager");
            return;
        }

        List <Road> roadListToCheck = waypointKeys[w1];
        Road        roadToUse       = null;

        foreach (Road r in roadListToCheck)
        {
            if (r.ReturnWaypoint1() == w2)
            {
                roadToUse = r;
                break;
            }
            else if (r.ReturnWaypoint2() == w2)
            {
                roadToUse = r;
                break;
            }
        }

        if (roadToUse == null)
        {
            Debug.Log("No road found in AddAntToRoad in FlowManager");
            return;
        }

        roadToUse.AddAnAnt();
    }