Esempio n. 1
0
		private GameObject spawnObject(SpawnTriple spawn) {
			GameObject spawnObject;

			if (!loadedResources.ContainsKey (spawn.resourceString)) {
				//if spawn.resourceString does not exist in loaded resource, load resource
				spawnObject = Resources.Load (spawn.resourceString, typeof(GameObject)) as GameObject;
				loadedResources.Add (spawn.resourceString, spawnObject);
			}
			else //use already loaded resource
				spawnObject = loadedResources[spawn.resourceString];

			//spawn @ position & rotation
			GameObject spawnedObject = (GameObject) Instantiate (spawnObject, spawn.position, spawn.rotation);
			return spawnedObject;
		}
Esempio n. 2
0
        public WeatherSpawnModel()
        {
            SpawnTriple stoppedCar0 = new SpawnTriple(Dark_AI_car_resource,
                                                      new Vector3(stoppedCarX, stoppedCarY, stoppedCarZ), stoppedCarRotation);
            SpawnTriple stoppedCar1 = new SpawnTriple(Dark_AI_car_resource,
                                                      new Vector3(stoppedCarX - 6, stoppedCarY, stoppedCarZ), stoppedCarRotation);
            SpawnTriple stoppedCar2 = new SpawnTriple(Dark_AI_car_resource,
                                                      new Vector3(stoppedCarX - 12, stoppedCarY, stoppedCarZ), stoppedCarRotation);
            SpawnTriple stoppedCar3 = new SpawnTriple(Dark_AI_car_resource,
                                                      new Vector3(stoppedCarX - 18, stoppedCarY, stoppedCarZ), stoppedCarRotation);

            initialSpawns = new List <SpawnTriple> ();

            initialSpawns.Add(stoppedCar0);
            initialSpawns.Add(stoppedCar1);
            initialSpawns.Add(stoppedCar2);
            initialSpawns.Add(stoppedCar3);
        }
Esempio n. 3
0
		public WeatherSpawnModel() {

			SpawnTriple stoppedCar0 = new SpawnTriple (Dark_AI_car_resource,
				new Vector3 (stoppedCarX, stoppedCarY, stoppedCarZ), stoppedCarRotation); 
			SpawnTriple stoppedCar1 = new SpawnTriple (Dark_AI_car_resource,
				new Vector3 (stoppedCarX-6, stoppedCarY, stoppedCarZ), stoppedCarRotation);
			SpawnTriple stoppedCar2 = new SpawnTriple (Dark_AI_car_resource,
				new Vector3 (stoppedCarX-12, stoppedCarY, stoppedCarZ), stoppedCarRotation); 
			SpawnTriple stoppedCar3 = new SpawnTriple (Dark_AI_car_resource,
				new Vector3 (stoppedCarX-18, stoppedCarY, stoppedCarZ), stoppedCarRotation);
			
			initialSpawns = new List<SpawnTriple> ();

			initialSpawns.Add (stoppedCar0);
			initialSpawns.Add (stoppedCar1);
			initialSpawns.Add (stoppedCar2);
			initialSpawns.Add (stoppedCar3);

		}
Esempio n. 4
0
        private GameObject spawnObject(SpawnTriple spawn)
        {
            GameObject spawnObject;

            if (!loadedResources.ContainsKey(spawn.resourceString))
            {
                //if spawn.resourceString does not exist in loaded resource, load resource
                spawnObject = Resources.Load(spawn.resourceString, typeof(GameObject)) as GameObject;
                loadedResources.Add(spawn.resourceString, spawnObject);
            }
            else             //use already loaded resource
            {
                spawnObject = loadedResources[spawn.resourceString];
            }

            //spawn @ position & rotation
            GameObject spawnedObject = (GameObject)Instantiate(spawnObject, spawn.position, spawn.rotation);

            return(spawnedObject);
        }
Esempio n. 5
0
 public void spawnOnDemand(int index)
 {
     SpawnTriple spawn = spawnModel.onDemandSpawns [index];
 }