//call the Lit function of the current target object void LightUpObject(GameObject obj) { if (obj == null) { return; } ObjectSelectable select = obj.GetComponent <ObjectSelectable>(); ObjectMultiSelectable multi = obj.GetComponent <ObjectMultiSelectable>(); if (multi != null && !multi.IsLit) { selectedObject = obj; multi.Lit(); isLit = true; return; } if (select != null && !select.IsLit) { selectedObject = obj; select.Lit(); isLit = true; return; } }
//call the Unlit function of the target object void UnlightObject(GameObject obj) { if (obj == null) { return; } ObjectSelectable select = obj.GetComponent <ObjectSelectable>(); ObjectMultiSelectable multi = obj.GetComponent <ObjectMultiSelectable>(); //if it's an object made of multiple parts if (multi != null && multi.IsLit) { multi.Unlit(); } //if it's not else if (select != null && select.IsLit) { select.Unlit(); } selectedObject = null; isLit = false; }