public void SetHelmetType(PC.HELMET_TYPE id) { switch (id.ToString()) { case "HL01": { this.HELMET_01LOD0.SetActive(true); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } case "HL02": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(true); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } case "HL03": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(true); this.HELMET_04LOD0.SetActive(false); break; } case "HL04": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(true); break; } default: { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } } }
public void SetHelmetType(Toggle id) { try { PC.HELMET_TYPE name = (PC.HELMET_TYPE)Enum.Parse(typeof(PC.HELMET_TYPE), id.name, true); if (id.isOn) { this.PC_CC.selectedHelmet = name; Debug.Log(string.Format("{0} was turned on", name)); } else { this.PC_CC.selectedHelmet = PC.HELMET_TYPE.none; Debug.Log(string.Format("{0} was turned off", name)); } } catch { // if the value passed is not in the enumeration set it to none this.PC_CC.selectedHelmet = PC.HELMET_TYPE.none; Debug.Log("Helmet Type Enumeration Not Found!"); } switch (id.name) { case "HL01": { this.HELMET_01LOD0.SetActive(id.isOn); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } case "HL02": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(id.isOn); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } case "HL03": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(id.isOn); this.HELMET_04LOD0.SetActive(false); break; } case "HL04": { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(id.isOn); break; } default: { this.HELMET_01LOD0.SetActive(false); this.HELMET_02LOD0.SetActive(false); this.HELMET_03LOD0.SetActive(false); this.HELMET_04LOD0.SetActive(false); break; } } }