void Start() { mouseSelect = Camera.main.GetComponent <MouseSelect>(); Transform Container = GameObject.FindGameObjectWithTag("BuildablesContainers").transform; for (int i = 0; i < Container.childCount; i++) { Buildables.Add(Container.GetChild(i).gameObject); } for (int i = 0; i < Buildables.Count; i++) { GameObject Butinst = Instantiate(ItemsButton, ItemsButton.transform.position, Quaternion.identity); Butinst.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); Butinst.GetComponent <Image>().sprite = Buildables[i].transform.GetChild(0).GetComponent <SpriteRenderer>().sprite; Butinst.transform.SetParent(Grid.transform); int a = i; Butinst.GetComponent <Button>().onClick.AddListener(delegate { this.ChangeBuildableTo(a + 1); }); } }
/// <summary> /// Raises the MouseSelect event. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Event arguments assocaited with the event.</param> protected void OnButtonMouseSelect(object sender, MouseEventArgs e) { MouseSelect?.Invoke(this, e); }
/// <summary> /// Raises the MouseSelect event. /// </summary> /// <param name="e">A MouseEventArgs containing the event data.</param> protected virtual void OnMouseSelect(MouseEventArgs e) { MouseSelect?.Invoke(_target, e); }
void Start() { BuiltObjectsParent = GameObject.FindGameObjectWithTag("MACHINEPARENT"); MouseSelectScript = Camera.main.GetComponent <MouseSelect>(); }
// Start is called before the first frame update void Start() { mouseSelection = FindObjectOfType<Camera>().GetComponent<MouseSelect>(); movementLocations = new List<GameObject>(); agent = GetComponent<NavMeshAgent>(); }
void Start() { Once = true; MouseSelect = Camera.main.GetComponent <MouseSelect>(); }
void Start() { MouseSelector = GameObject.FindGameObjectWithTag("TargetSelector").GetComponent <MouseSelect>(); }