Exemple #1
0
    public Junction Create(Vector3 position, Junction predecessor = null)
    {
        Junction newJunction = Instantiate(prefab, position, Quaternion.identity, transform).GetComponent <Junction>();

        newJunction.ifLights = ifLightsSetting;

        if (predecessor != null)
        {
            if (SimulationManager.RoadManager.backwardLaneCountSetting > 0)
            {
                predecessor.AddConsequentBothWays(newJunction);
            }
            else
            {
                predecessor.AddConsequent(newJunction);
            }
        }

        junctions.Add(newJunction);

        return(newJunction);
    }