void Awake() { if (equipmentInstanceList == null) { equipmentInstanceList = new List <GameObject> (); } GameObject player = GameObject.FindGameObjectWithTag("Player"); screenRect = GetComponent <RectTransform>(); if (player) { manager = player.GetComponent <PlayerManager> (); if (manager) { GameObject temp = Instantiate(weaponWheelPrefab, mainButtonObject.transform, false); RectTransform rect = temp.GetComponent <RectTransform> (); //rect.position = new Vector3 (Screen.width / 2.0f, Screen.height / 2.0f, 0.0f); rect.localPosition = Vector3.zero; rect.localScale = Vector3.one; weaponWheel = temp.GetComponent <WeaponSelectWheel> (); } } healthBar = healthBarObject.GetComponent <Slider>(); crouchButton = crouchButtonObject.GetComponent <Button>(); screenWidth = (int)(screenRect.rect.width + 1); screenHeight = (int)(screenRect.rect.height + 1); }
void Awake() { equipmentInstanceList = new List <GameObject> (); GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player) { manager = player.GetComponent <PlayerManager> (); if (manager) { GameObject temp = GameObject.Instantiate(weaponWheelPrefab); temp.transform.SetParent(gameObject.transform, false); RectTransform rect = temp.GetComponent <RectTransform> (); rect.position = new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0.0f); rect.localScale = Vector3.one; weaponWheel = temp.GetComponent <WeaponSelectWheel> (); } } }