void Update() { if (!interactablesEnabled) { glowObj?.TurnOffGlow(); return; } if (Vector3.Distance(player.transform.position, transform.position) <= range) { if (activateOnEnter) { Activate(); } else { if (player.interacting) { Activate(); } } if (glowObj != null) { glowObj.TurnOnGlow(); } } else { if (glowObj != null) { glowObj.TurnOffGlow(); } } }
private void OnTriggerExit(Collider other) { GlowObject glowObj = gameObject.GetComponent <GlowObject>(); if (glowObj != null) { glowObj.TurnOffGlow(); } }