Ejemplo n.º 1
0
    void Start()
    {
        waypointsGO = GameObject.FindGameObjectsWithTag("Waypoint");

        TrafficPerson = 0;
        TrafficCars   = 0;

        //gameObjects = GameObject.FindGameObjectsWithTag("Untagged");

        /*
         * int temp8 = 0;
         * int temp9 = 0;
         *
         * foreach (GameObject gameObject in gameObjects) {
         *  if (gameObject.layer == 8)
         *  {
         *      waypointsGO[temp8] = gameObject;
         *      temp8++;
         *  }
         *  else if (gameObject.layer == 9) {
         *      carWaypointsGO[temp9] = gameObject;
         *      temp9++;
         *  }
         * }
         */

        if (waypointsGO != null)
        {
            foreach (GameObject gameObject in waypointsGO)
            {
                Waypoint temp = gameObject.GetComponent <Waypoint>();
                if (temp != null && temp.isSpawner == true)
                {
                    waypointsStruct str = new waypointsStruct();
                    str.waypoint  = temp;
                    str.transform = gameObject.GetComponent <Transform>();
                    str.isActive  = false;
                    waypoints.Add(str);
                }
            }
        }
        carWaypointsGO = GameObject.FindGameObjectsWithTag("CarWaypoint");

        if (carWaypointsGO != null)
        {
            foreach (GameObject gameObject in carWaypointsGO)
            {
                CarWaypoint temp = gameObject.GetComponent <CarWaypoint>();
                if (temp != null && temp.isSpawner == true)
                {
                    carWaypointsStruct str = new carWaypointsStruct();
                    str.carWaypoint = temp;
                    str.transform   = gameObject.GetComponent <Transform>();
                    str.isActive    = false;
                    carWaypoints.Add(str);
                }
            }
        }
    }
Ejemplo n.º 2
0
 void Activate1(waypointsStruct wayP, bool isActive)
 {
     wayP.isActive = isActive;
 }