public override void OnAction() { GameObject obj = controller.player.GetItem(); if (obj ? (obj.CompareTag("Egg") || obj.CompareTag("RawMeat")) : false) { base.OnAction(); if (GetItem() == obj) { obj.GetComponent <Catchable>().enabled = false; bar.Play(); controller.frieSound.Play(); var em = ps.emission; em.enabled = true; } } }
// Interactuando void OnTriggerStay(Collider other) { if (!Empty()) { if (GetItem().CompareTag("Apple")) { if (other.gameObject == player) { bool isOpen = anim.GetBool(animBoolName); anim.enabled = true; anim.SetBool(animBoolName, true); } if (Input.GetButtonDown("Circle") || Input.GetKeyDown(KeyCode.E)) { if (!bar.IsPlaying()) { bar.Play(); GetItem().GetComponent <Catchable>().enabled = false; } else { bar.Continue(); } anim.SetBool(animBoolName2, true); } if (Input.GetButtonUp("Circle") || Input.GetKeyUp(KeyCode.E)) { anim.SetBool(animBoolName2, false); if (bar.IsPlaying()) { bar.Stop(); } } } else { anim.SetBool(animBoolName, false); anim.SetBool(animBoolName2, false); anim.SetBool(animBoolName2, false); } } }
// Accion del horno public override void OnAction() { GameObject obj = controller.player.GetItem(); if (obj != null) { if (obj.CompareTag("Egg") && !hasEgg) { hasEgg = true; SetItem(obj); } else if (obj.CompareTag("CutApple") && !hasApple) { hasApple = true; SetItem(obj); } } if (ended) { Done(); Selectable pie = GetItem().GetComponent <Selectable>(); pie.TriggerClick(); if (pie.isDone) { ended = false; hasEgg = false; hasApple = false; } } else { if (hasApple && hasEgg && !bar.IsPlaying()) { bar.Play(); ovenLight.enabled = true; } } }