public void AmmoClick() { Cleanup(); if (m_ActiveWeapon != null) { foreach (WeaponCustomizerActivator weaponBase in m_BaseObjectList) { var activator = m_ActiveWeapon.GetComponent <WeaponCustomizerActivator>(); var configurator = activator.GetBaseConfigurator(); var ammoSets = configurator.m_WeaponProfiles[activator.m_ProfileConfig].m_AmmoSets; foreach (var ammoSet in ammoSets) { var ammos = ammoSet.m_AmmoParts; foreach (var ammo in ammos) { GameObject go = GameObject.Instantiate(m_PartSlotPrefab); PartSlotMonitor monitor = go.GetComponent <PartSlotMonitor>(); monitor.Setup(PartSlotMonitor.PartSlotType.Ammo, m_ActiveAmmoDisplay, this); Text txt = go.GetComponentInChildren <Text>(); txt.text = ammo.m_PartName; go.transform.SetParent(m_PartSlotPanel.transform); } } } } }
public void ProfileClick() { Cleanup(); foreach (WeaponCustomizerActivator weaponBase in m_BaseObjectList) { var configurator = weaponBase.GetBaseConfigurator(); var profiles = configurator.m_WeaponProfiles; foreach (var profile in profiles) { GameObject go = GameObject.Instantiate(m_PartSlotPrefab); PartSlotMonitor monitor = go.GetComponent <PartSlotMonitor>(); monitor.Setup(PartSlotMonitor.PartSlotType.Profile, m_ActiveProfileDisplay, this); Text txt = go.GetComponentInChildren <Text>(); txt.text = profile.m_ProfileName; go.transform.SetParent(m_PartSlotPanel.transform); } } }