void Awake() { planeManager = transform.parent.parent.GetChild(1).GetComponent <PlaneManager>(); slotScript = transform.parent.parent.GetComponent <SlotScript>(); imageSlotExtractor = transform.parent.parent. parent.GetComponent <ImageSlotExtractor>(); }
void Start() { //Alustetaan taulukot parkkipaikkojen määrää vastaaviksi //cars = new GameObject[numberOfSlots]; //pcontroller = new bool[numberOfSlots]; // Haetaan määritettyjen parkkiruutujen kokonaislukumäärä ImageSlotExtractor ise = (ImageSlotExtractor)Object.FindObjectOfType(typeof(ImageSlotExtractor)); numberOfSlots = ise.GetTotalSlotCount(); int rowcount = ise.GetRowCount(); // init arrays for (int i = 0; i < rowcount; i++) { int slotCount = ise.GetSlotCount(i); //init slots in rows bool[] slots = new bool[slotCount]; rows.Add(slots); //init cars in rows GameObject[] carsInRows = new GameObject[slotCount]; cars.Add(carsInRows); } int rowIndex = 0; //Alustetaan parkkipaikat ja navmeshobstaclet tyhjiksi foreach (bool[] slots in rows) { for (int i = 0; i < slots.Length; i++) { slots[i] = false; cars[rowIndex][i] = null; setNMO(false, rowIndex, i); } rowIndex++; } }
// Use this for initialization void Awake() { ise = transform.parent.GetComponent <ImageSlotExtractor>(); sourceMaterial = transform.GetChild(1).GetChild(1).GetChild(0).GetComponent <Renderer>().material; }