private void GetAllCamChilds() { camChild = new Transform[amountOfCamChildObj]; camChildBtnSlots = new Transform[amountOfCamBtnSlots]; if (Camera.main.transform != null) { for (int i = 0; i < Camera.main.transform.childCount; i++) { camChild[i] = Camera.main.transform.GetChild(i); if (i < amountOfCamBtnSlots) { camChildBtnSlots[i] = Camera.main.transform.GetChild(i); } } //DISABLEs the col the slots in cam child // + doc in the top comments UColi.SetColiState(camChildBtnSlots, H.Disable); } }
/// <summary> /// will close current menu .. if was in pause the game will fire up the still btns /// </summary> /// <param name="forcedP">need to be forced only if the game is paused</param> private void CloseCurrentMenu(bool forcedP = false) { if (!Settings.ISPAUSED || forcedP) { for (int i = 0; i < btnArray.Length; i++) { if (btnArray[i] != null) { btnArray[i].Destroy2dBtn(); } } SetBtnsAndNameThem(howManyBtns); UpdateList(); MenuHandler.CREATEMENU = true; //DISABLEs the col the slots in cam child // + doc in the top comments UColi.SetColiState(camChildBtnSlots, H.Disable); } }
/// <summary> /// spawns Set of buttons based on which menu was passed /// </summary> /// <param name="whichMenu">Which menu will be spawn </param> /// <param name="fadeSpeedPass"></param> /// <param name="slotsP">if we are sending an array of slotP[] then we will assign it mannually the /// slots in the camera to the new 2d Btns</param> private void SpawnSetMenu(string whichMenu, float fadeSpeedPass = 25f, int[] slotsP = null) { //we are looking for the a set of obj tht are stored in the list myMenuSets as a list as well int listIndex = Root.ReturnListNumber(whichMenu); howManyBtns = Root.myMenuSets[listIndex].Count - 1; /*bz last one is spawner*/ int max = Root.myMenuSets[listIndex].Count - 2; //use it for find the middle one SetBtnsAndNameThem(howManyBtns); if (MenuHandler.CREATEMENU) { for (int i = 0; i < howManyBtns; i++) { btnArray[i] = (Btn2D)General.Create(Root.myMenuSets[listIndex][i]); //if slots is null we will assign slots in the camera child btn automatically //defined in SetBtnsAndNameThem() only useful for 3 or 5 if (slotsP == null) { btnArray[i].MyTransform = setOfBtn[i]; } //if we are sending an array of slotP[] then we will assign it mannually the //slots in the camera to the new 2d Btns else { btnArray[i].MyTransform = camChildBtnSlots[slotsP[i]]; } btnArray[i].StartMaterial(); btnArray[i].FadeSpeedProp = fadeSpeedPass; } UpdateList(); MenuHandler.CREATEMENU = false; //enables the col the slots in cam child// + doc in the top comments UColi.SetColiState(camChildBtnSlots, H.Enable); } }