Ejemplo n.º 1
0
    public RoadCollection(RoadComponent currentRoad)
    {
        collection         = new Dictionary <RoadType, RoadComponent>();
        placedRoadsByOrder = new List <RoadType>();

        RoadType type = currentRoad.GetRoadType();

        Add(currentRoad);
        SetCurrent(type);
        Place(type);
    }
Ejemplo n.º 2
0
    public void Add(RoadComponent road)
    {
        RoadType type = road.GetRoadType();

        if (collection.ContainsKey(type))
        {
            Debug.LogError("RoadCollection:Add: road of this type existed");
            return;
        }
        collection.Add(type, road);
    }
Ejemplo n.º 3
0
    private void Initialize()
    {
        RoadComponent component = transform.GetChild(0).GetComponent <RoadComponent>();

        collection = new RoadCollection(component);

        int count = transform.childCount;

        for (int i = 1; i < count; i++)
        {
            component = transform.GetChild(i).GetComponent <RoadComponent>();
            collection.Add(component);
            collection.Place(component.GetRoadType());
        }
    }