//Buttons for Teleport Tab public void PlacesGenButtons() { if (SearchBar != null) { SearchBar.Resettext(); } gameObject.transform.Find("TitleText").GetComponent <TextMeshProUGUI>().text = "<b>Teleport To Location</b>"; foreach (GameObject x in teleportButtons) //resets buttons everytime it opens { Destroy(x); } ghostTeleport = GetComponentInParent <GhostTeleport>(); ghostTeleport.PlacesFindData(); //Calls the script in GhostTeleport.cs to find the place data. for (int i = 0; i < ghostTeleport.PlacesCount; i++) { GameObject button = Instantiate(buttonTemplate) as GameObject; //creates new button button.SetActive(true); var c = button.GetComponent <TeleportButton>(); c.SetTeleportButtonText(ghostTeleport.PlacesDict[i].Item1 + "\n" + ghostTeleport.PlacesDict[i].Item2); c.index = i; //Gives button a number, used to tell which data index is used for teleport teleportButtons.Add(button); button.transform.SetParent(buttonTemplate.transform.parent, false); } }
void Start() { root = transform.parent.parent.gameObject; //childFrustum = GetComponentInChildren<LocalFrustum>(); charge = root.GetComponent <GhostCharge>(); teleport = root.GetComponent <GhostTeleport>(); }
public void Onclick() { ghostTeleport = GetComponentInParent <GhostTeleport>(); if (MobTeleport == true) { ghostTeleport.DataForTeleport(index); // Gives index to GhostTeleport.cs } else { ghostTeleport.PlacesDataForTeleport(index); // Gives index to GhostTeleport.cs } }
void Start() { ghostThrow = GetComponentInParent <GhostThrow> (); ghostTeleport = GetComponentInParent <GhostTeleport>(); }