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 OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { if (activateOnEnter) { Activate(); } else { if (player.interacting) { Activate(); } } } GlowObject glowObj = gameObject.GetComponent <GlowObject>(); if (glowObj != null) { glowObj.TurnOnGlow(); } }