void OnValidate() { UiWeaponPartSlotPanel uiSlot = GetComponentInChildren <UiWeaponPartSlotPanel>(); if (uiSlot != null) { uiSlot.slotName.text = slotName; } }
void Awake() { if (SceneManager.GetActiveScene().name != "WeaponCustomization") { return; } UiWeaponPartSlotPanel uiSlot = Instantiate(uiSlotPrefab, transform).GetComponent <UiWeaponPartSlotPanel>(); uiSlot.transform.localPosition = uiSlotPosition; uiSlot.slotName.text = slotName; }
/// <summary> /// Use this for initialization /// </summary> protected override void Initialize() { base.Initialize(); dragPanel = GameObject.FindGameObjectWithTag("WeaponPartItemPanel").GetComponent <DragAndDropPanel>(); slot = GetComponentInParent <WeaponPartSlot>(); panel = GetComponent <UiWeaponPartSlotPanel>(); panel.SetIndeces(containerIndex, new int[] { 0 }); panel.SetObject(slot.part); uiWeaponPartList = FindObjectOfType <UiWeaponPartList>(); }
void Load() { weapon.bodySlot.SetPart(null); playerData.LoadWeapon(selectedWeapon, weapon); weaponNameInput.text = weapon.weaponName; UiWeaponPartSlotPanel uiSlot = weapon.bodySlot.GetComponentInChildren <UiWeaponPartSlotPanel>(); if (uiSlot != null) { uiSlot.SetObject(weapon.bodySlot.part); } UiWeaponStats.UpdateStats(); }