private void NotifyTriggersOn() { pressedAnimationCountDown = pressedTime; currentlyPressed = true; spriteRenderer.sprite = pressedSprite; for (int i = 0; i < myListener.Length; i++) { ButtonListener thisListerner = myListener[i]; thisListerner.OnButtonTrigger(gameObject); thisListerner.OnButtonTriggerEnter(gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { //Debug.Log(other); GameObject source = other.gameObject; ButtonInteractable bti = source.GetComponent <ButtonInteractable>(); if (bti) { Weight sourceWeight = bti.myWeight; if (sourceWeight >= requiredWight) { for (int i = 0; i < myListener.Length; i++) { ButtonListener thisListerner = myListener[i]; thisListerner.OnButtonTrigger(gameObject); thisListerner.OnButtonTriggerEnter(gameObject); } } } throw new Exception("Old button AI used. Please use new one."); }
private void OnTriggerEnter2D(Collider2D other) { Sharp mySharp = other.gameObject.GetComponent <Sharp>(); if (!isBurned && mySharp && (mySharp.sharpness == Sharpness.Burning || mySharp.sharpness == Sharpness.Normal)) { for (int i = 0; i < buttonListener.Length; i++) { ButtonListener myListener = buttonListener[i]; myListener.OnButtonTrigger(gameObject); myListener.OnButtonTriggerEnter(gameObject); } GetComponent <AudioSource>().Play(); isBurned = true; if (activateTime > 0) { _activateTimer = activateTime; } } }