public void Interact() { if (!activated) { activated = true; if (animator != null) { animator.SetBool("activated", true); } if (target != null) { target.Activate(); } } else { activated = false; if (animator != null) { animator.SetBool("activated", false); } if (target != null) { target.Deactivate(); } } m_AudioPlayer.PlaySFX(sound); }
public void DeactivateObject() { Active = false; if (_sourceAndTarget) { _activatableObject.LockSource(); } else { _activatableObject.Deactivate(); } }
public void OnTriggerExit2D(Collider2D collision) { if (!collision.CompareTag("Projectile")) { if (triggerCount == 1) { if (target != null) { target.Deactivate(); } if (spriteRenderer != null) { spriteRenderer.color = Color.white; } m_AudioPlayer.PlaySFX(deactivateSfx); } --triggerCount; } }