private void OnTriggerStay2D(Collider2D other) { WeightsInteraction weightsInteraction = other.GetComponent <WeightsInteraction>(); if (weightsInteraction != null && !m_opened) { m_opened = true; m_render.sprite = m_openBoxSprite; m_key.gameObject.SetActive(true); m_canShowOutline = false; Character character = FindObjectOfType <Character>(); character.PlayAudio("wood_broken"); } }
protected void OnTriggerStay2D(Collider2D other) { WeightsInteraction weight = other.gameObject.GetComponent <WeightsInteraction>(); if (weight != null) { if (m_opened) { m_animator.Play("Cellar_Close"); m_opened = false; } } else { if (!m_opened) { m_animator.Play("Cellar_Open"); m_opened = true; } } }