public void SetShieldType(PC.SHIELD_TYPE id) { switch (id.ToString()) { case "SL01": { this.SHIELD_01LOD0.SetActive(true); this.SHIELD_02LOD0.SetActive(false); break; } case "SL02": { this.SHIELD_01LOD0.SetActive(false); this.SHIELD_02LOD0.SetActive(true); break; } default: { this.SHIELD_01LOD0.SetActive(false); this.SHIELD_02LOD0.SetActive(false); break; } } }
public void SetShieldType(Toggle id) { try { PC.SHIELD_TYPE name = (PC.SHIELD_TYPE)Enum.Parse(typeof(PC.SHIELD_TYPE), id.name, true); if (id.isOn) { this.PC_CC.selectedShield = name; Debug.Log(string.Format("{0} was turned on", name)); } else { this.PC_CC.selectedShield = PC.SHIELD_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.selectedShield = PC.SHIELD_TYPE.none; Debug.Log("Shield Type Enumeration Not Found!"); } switch (id.name) { case "SL01": { this.SHIELD_01LOD0.SetActive(id.isOn); this.SHIELD_02LOD0.SetActive(false); break; } case "SL02": { this.SHIELD_01LOD0.SetActive(false); this.SHIELD_02LOD0.SetActive(id.isOn); break; } default: { this.SHIELD_01LOD0.SetActive(false); this.SHIELD_02LOD0.SetActive(false); break; } } }