Example #1
0
 /// <summary>
 /// Awake method.
 /// </summary>
 void Awake()
 {
     globalParam = FindObjectOfType <FlashPedestriansGlobalParameters>();
     navAgent    = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>();
     FSM         = gameObject.GetComponent <Animator>();
     balloons    = transform.Find("Balloons");
 }
    void Awake()
    {
        pedGlobalParam = FindObjectOfType <FlashPedestriansGlobalParameters>();

        logSeriesId = LoggerAssembly.GetLogSeriesId();

        //LOG STATION LOG INFO
        log.Info(string.Format("{0}:{1}:{2}", logSeriesId, "title", GetIdAndName() + " log"));
        //LOG STATION QUEUING CHART INFO
        log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "chart type", 0, UIChartTypes.Line.ToString()));
        //LOG STATION LOG INFO
        log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "legend", 0, GetIdAndName() + " queuing"));

        Collider[] coll = Physics.OverlapSphere(this.transform.position, radiusToCheckStations * 10, 1 << LayerMask.NameToLayer("Stations"));

        List <StationController> aux = new List <StationController>();

        // Add all the stations found except for this one
        foreach (Collider C in coll)
        {
            StationController station = C.GetComponent <StationController>();

            if (!station.Equals(this))
            {
                aux.Add(station);
            }
        }

        stationsNearThisStation = aux.ToArray();
    }
 void Awake()
 {
     logSeriesId       = LoggerAssembly.GetLogSeriesId();
     globalParam       = FindObjectOfType <FlashPedestriansGlobalParameters>();
     flashInformer     = FindObjectOfType <FlashPedestriansInformer>();
     freeMessageWindow = FindObjectOfType <FlashFreeMessageWindowController>();
 }
Example #4
0
    /// <summary>
    /// Awakes the script.
    /// </summary>
    void Awake()
    {
        // Get the global parameters of Flash Pedestrians
        pedGlobalParameters = GetComponentInParent <FlashPedestriansGlobalParameters>();

        // Fill the cache with pedestrians
        for (int i = 0; i < initialNumberOfPedestriansInCache; i++)
        {
            GameObject newAgent = Instantiate(pedGlobalParameters.pedestrianObject, Vector3.zero, Quaternion.identity) as GameObject;
            newAgent.transform.SetParent(this.transform, true);
            pedestrianCache.Enqueue(newAgent);
        }

        // Get the stations that are around the spawner
        Collider[] coll = Physics.OverlapSphere(this.transform.position, radiousToCheckStations, 1 << LayerMask.NameToLayer("Stations"));

        List <StationController> aux = new List <StationController>();

        foreach (Collider C in coll)
        {
            aux.Add(C.GetComponent <StationController>());
        }

        stationsNearThisSpawner = aux.ToArray();

        //Debug.Log(this.gameObject.name +  " has found " + stationsNearThisSpawner.Length
        //    + " stations nearby");

        // Get the itinerary controller
        flashInformer = FindObjectOfType <FlashPedestriansInformer>();

        // Get the destinations
        destinationPoints = FindObjectsOfType <FlashPedestriansDestination>();
    }
 void Awake()
 {
     logSeriesId  = LoggerAssembly.GetLogSeriesId();
     globalParam  = FindObjectOfType <FlashPedestriansGlobalParameters>();
     pedInformer  = FindObjectOfType <FlashPedestriansInformer>();
     stationStats = FindObjectOfType <StationStatistics>();
     spawners     = FindObjectsOfType <FlashPedestriansSpawner>();
 }
    /// <summary>
    /// Awake method.
    /// </summary>
    void Awake()
    {
        globalParam       = FindObjectOfType <FlashPedestriansGlobalParameters>();
        routingController = FindObjectOfType <RoutingController>();
        activePedestrians = new Dictionary <int, FlashPedestriansController>();
        secondsPerMeter   = 1 / globalParam.averageSpeed;

        logSeriesId = LoggerAssembly.GetLogSeriesId();

        bikeStations = new Dictionary <int, BikeStationScript>();
    }
    void Awake()
    {
        destinationTransform = this.transform;

        FlashPedestriansGlobalParameters pedGlobalParameters = GetComponent <FlashPedestriansGlobalParameters>();

        // Get the stations near this destination point
        stationsNearThisDestination = Physics.OverlapSphere(destinationTransform.position, radiousToCheckStations, 1 << LayerMask.NameToLayer("Stations"));

        //Debug.Log(this.gameObject.name + " has found " + stationsNearThisDestination.Length
        //+ " stations nearby");
    }
    //public EventButtonPanelController ebpc;

    void Awake()
    {
        //TODO: Make log for the weather conditions events

        //logSeriesId = LoggerAssembly.GetLogSeriesId();

        //LOG SUBSCRIBER SLIDER LOG INFO
        //log.Info(string.Format("{0}:{1}:{2}", logSeriesId, "title", "Subscriber slider log"));

        //LOG SUBSCRIBER SLIDER VALUE CHART INFO
        //log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "chart type", 1, UIChartTypes.Line.ToString()));

        //LOG SUBSCRIBER SLIDER LOG INFO
        //log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "legend", 0, "Subscriber slider value changed"));
        //log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "legend", 1, "Subscriber slider value"));

        globalFlashParam = FindObjectOfType <FlashPedestriansGlobalParameters>();

        // Check the toggle of the initial weather condition according to the global parameters
        switch (globalFlashParam.currentWeatherCondition)
        {
        case FlashPedestriansGlobalParameters.WeatherConditions.SunnyWeather:
            if (sunnyToggle != null)
            {
                sunnyToggle.isOn = true;
            }
            break;

        case FlashPedestriansGlobalParameters.WeatherConditions.WindyWeather:
            if (windyToggle != null)
            {
                windyToggle.isOn = true;
            }
            break;

        case FlashPedestriansGlobalParameters.WeatherConditions.RainyWeather:
            if (rainyToggle != null)
            {
                rainyToggle.isOn = true;
            }
            break;
        }

        //if (ebpc == null)
        //    ebpc = FindObjectOfType<EventButtonPanelController>();
    }
    /// <summary>
    /// Awakes the script.
    /// </summary>
    void Awake()
    {
        logSeriesId = LoggerAssembly.GetLogSeriesId();

        smc  = FindObjectOfType <SumoMainController>();
        tic  = FindObjectOfType <TrafficIntegrationController>();
        ebpc = FindObjectOfType <EventButtonPanelController>();
        fped = FindObjectOfType <FlashPedestriansGlobalParameters>();

        if (timeSlider != null)
        {
            timeSliderContr = timeSlider.GetComponent <TimeSliderController>();
        }

        if (loadingSplash != null)
        {
            loadingSplash.SetActive(true);
        }
    }
Example #10
0
    void Awake()
    {
        logSeriesId = LoggerAssembly.GetLogSeriesId();

        //LOG SUBSCRIBER SLIDER LOG INFO
        log.Info(string.Format("{0}:{1}:{2}", logSeriesId, "title", "Bikers slider log"));

        //LOG SUBSCRIBER SLIDER VALUE CHART INFO
        log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "chart type", 1, UIChartTypes.Line.ToString()));

        //LOG SUBSCRIBER SLIDER LOG INFO
        log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "legend", 0, "Bikers slider value changed"));
        log.Info(string.Format("{0}:{1}:{2}:{3}", logSeriesId, "legend", 1, "Bikers slider value"));

        globalFlashParam = FindObjectOfType <FlashPedestriansGlobalParameters>();

        if (ebpc == null)
        {
            ebpc = FindObjectOfType <EventButtonPanelController>();
        }
    }
Example #11
0
    /// <summary>
    /// Awakes the script.
    /// </summary>
    void Awake()
    {
        Debug.Log("Initializing pedestrian spawner...");

        // Get the time controller
        timeCtrl = FindObjectOfType <TimeController>();

        // Get the camera controller
        cameraCtrl = FindObjectOfType <CameraControl>();

        // Get the global parameters of Flash Pedestrians
        pedGlobalParameters = GetComponentInParent <FlashPedestriansGlobalParameters>();

        // Get the heatmap controller
        heatmapCtrl = FindObjectOfType <HeatmapLayer.HeatmapController>();

        // Fill the cache with pedestrians
        for (int i = 0; i < initialNumberOfPedestriansInCache; i++)
        {
            //Random.Range(0, pedGlobalParameters.pedestrianObject.Length)
            GameObject newAgent = Instantiate(pedGlobalParameters.pedestrianObject,
                                              Vector3.zero, Quaternion.identity) as GameObject;

            newAgent.transform.SetParent(this.transform, true);
            pedestrianCache.Enqueue(newAgent);
        }

        // Get the stations that are around the spawner
        Collider[] coll = Physics.OverlapSphere(this.transform.position, radiousToCheckStations, 1 << LayerMask.NameToLayer("Stations"));

        List <StationController> aux = new List <StationController>();

        foreach (Collider C in coll)
        {
            aux.Add(C.GetComponent <StationController>());
        }

        stationsNearThisSpawner = aux.ToArray();

        // Set the spawning points around the spawner
        spawningPoints = new Vector3[numberOfSpawningPoints];
        for (int i = 0; i < numberOfSpawningPoints; i++)
        {
            Vector3 point = new Vector3(
                this.transform.position.x + Random.Range(-radiousToPutSpawningPoints, radiousToPutSpawningPoints),
                0f,
                this.transform.position.z + Random.Range(-radiousToPutSpawningPoints, radiousToPutSpawningPoints));

            //Move the spawning point to the closest point in the walkable navmesh
            UnityEngine.AI.NavMeshHit hit;

            UnityEngine.AI.NavMesh.SamplePosition(point, out hit, 1000.0f,
                                                  1 << UnityEngine.AI.NavMesh.GetAreaFromName("footway") | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("residential")
                                                  | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("cycleway") | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("Pedestrian")
                                                  | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("step") | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("TrafficRoads")
                                                  | 1 << UnityEngine.AI.NavMesh.GetAreaFromName("Walkable"));

            point = hit.position;

            spawningPoints[i] = point;

            //Visualize the spawner
            var spawner = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
            spawner.transform.parent     = this.transform;
            spawner.transform.localScale = new Vector3(2f, 0.1f, 2f);

            spawner.gameObject.name = "SpawningPoint" + i;

            if (spawningMaterial != null)
            {
                spawner.GetComponent <MeshRenderer>().material = spawningMaterial;
            }

            if (!visualizeSpawners)
            {
                spawner.GetComponent <MeshRenderer>().enabled = false;
            }

            spawner.transform.position = point;
        }

        //Debug.Log(this.gameObject.name +  " has found " + stationsNearThisSpawner.Length
        //    + " stations nearby");

        // Get the itinerary controller
        flashInformer = FindObjectOfType <FlashPedestriansInformer>();

        // Get the destinations
        destinations = FindObjectsOfType <FlashPedestriansDestination>();
    }
 /// <summary>
 /// Script awakening.
 /// </summary>
 void Awake()
 {
     spawners  = FindObjectsOfType <FlashPedestriansSpawner>();
     pedGlobal = FindObjectOfType <FlashPedestriansGlobalParameters>();
 }
 void Awake()
 {
     logSeriesId = LoggerAssembly.GetLogSeriesId();
     globalParam = FindObjectOfType <FlashPedestriansGlobalParameters>();
     spawners    = FindObjectsOfType <FlashPedestriansSpawner>();
 }
Example #14
0
 void Awake()
 {
     station     = this.gameObject.GetComponent <StationController>();
     globalParam = FindObjectOfType <FlashPedestriansGlobalParameters>();
 }
 // Use this for initialization
 void Awake()
 {
     flashPedestriansGlobalParameters = GameObject.Find("FlashPedestriansModule").GetComponent <FlashPedestriansGlobalParameters>();
 }