示例#1
0
    // Nathan wrote this
    // class constructor
    // road is the road object in the development environment
    public RoadData(Road road)
    {
        // store the environment as an EnvironmentData variable
        Buildings buildingScriptReference = road.getBuildingsReference();

        buildingsIndex = buildingScriptReference.getBuildingIndex();
        // store the fog variables
        FogControl fogControlScriptReference = road.getFogControl();

        fogDistance = fogControlScriptReference.getFogDistance();
        // store the lighting intensities
        BrightnessControl[] lightScripts = road.getLights();
        for (int i = 0; i < lightScripts.Length; i++)
        {
            lightIntensities[i] = lightScripts[i].getBrightness();
        }
        // store the lanes as a list of LaneData
        LinkedList <GameObject> roadLanes = road.getLanes();

        // store the lanes
        foreach (GameObject lane in roadLanes)
        {
            BasicLane laneScriptRef = (BasicLane)lane.GetComponent("BasicLane");
            LaneData  indLaneData   = null;

            // if we have a non-vehicle lane, create the independent lane data with a prop manager
            if (!laneScriptRef.isVehicleLane())
            {
                PropManager propManagerRef = lane.GetComponent <PropManager>();
                indLaneData = new LaneData(laneScriptRef, propManagerRef);
            }
            else
            {
                indLaneData = new LaneData(laneScriptRef);
            }

            laneData.Add(indLaneData);
        }
    }
示例#2
0
 private void updateUIValues()
 {
     transform.Find("BrightnessLevelControls/BrightnessBackground/BrightnessField").GetComponent <Text>().text = lightController.getBrightness().ToString("0.0");
     transform.Find("FogLevelControls/Background/FogField").GetComponent <Text>().text   = fogController.getFogDistance().ToString();
     transform.Find("ArchitectureTypeControls/ArchType").GetComponent <Dropdown>().value = GameObject.Find("Buildings").GetComponent <Buildings>().getBuildingIndex();
 }