public void SpawnNewCabin() { GameObject newCabin = Instantiate(cabinPrefab, skiLiftStart.GetComponent <SkiLiftStartComp> ().rightAnchor.transform.position, skiLiftStart.GetComponent <SkiLiftStartComp> ().rightAnchor.transform.rotation); SkiLiftCabin cabinComp = newCabin.GetComponent <SkiLiftCabin> (); cabinComp.wps = wps; cabinComp.StartCoroutine(cabinComp.SetCabinOn()); currentCabinNumber += 1; if (currentSkiersWaiting.Count >= 1) { LoadSkiers(newCabin); } }
public void LoadSkiers(GameObject cabin) { SkiLiftCabin cabinComp = cabin.GetComponent <SkiLiftCabin> (); int i = cabinComp.maxSkierCapacity;; foreach (GameObject go in currentSkiersWaiting) { if (i > 0) { if (i < cabinComp.maxSkierCapacity) { go.transform.parent = cabin.transform; go.transform.position = cabinComp.cabinModel.transform.position; cabinComp.currentLoadedSkiers.Add(go); StartCoroutine(RemoveSkierFromQueue(go)); cabinComp.hasSkiers = true; } } i -= 1; } }