public override void Execute(Player activePlayer) { if (activePlayer.myInteractions.HoldingObj && activePlayer.myInteractions.HoldingObj is Interacao_Telefone) { if (activePlayer.isBusy) { return; } Interacao_Telefone phone = (Interacao_Telefone)activePlayer.myInteractions.HoldingObj; PlacePhone(phone); } }
public void GrabObj() { if (!HoldingObj) { HoldingObj = Target; HoldingObj.GetComponent <BoxCollider2D>().enabled = false; HoldingObj.transform.SetParent(transform.Find("Sprites")); HoldingObj.transform.localPosition = new Vector3(0.3f, -0.15f, 0); HoldingObj.GetComponent <Rigidbody2D>().isKinematic = true; Target = null; anim_char.SetBool("Segurando", true); if (HoldingObj is Interacao_Telefone) { Interacao_Telefone phone = (Interacao_Telefone)HoldingObj; phone.onBase = false; phone.Held = true; } } }
public void DropObj() { if (HoldingObj) { HoldingObj.transform.SetParent(null); HoldingObj.GetComponent <BoxCollider2D>().enabled = true; HoldingObj.GetComponent <Rigidbody2D>().isKinematic = false; HoldingObj = null; anim_char.SetBool("Segurando", false); if (HoldingObj is Interacao_Telefone) { Interacao_Telefone phone = (Interacao_Telefone)HoldingObj; phone.Held = false; } /* Interacoes de botar prato na pia * * if(HoldingObj is Interacao_Prato && Target is Interacao_Pia){ * Interacao_Pia Pia = (Interacao_Pia)Target; * Interacao_Prato[] allPratos = FindObjectsOfType<Interacao_Prato>(); * for(int i=0;i < Pia.SlotPos.Length;i++){ * bool EmptySlot = true; * for(int j=0; j < allPratos.Length;j++){ * if(allPratos[j].transform.position == Pia.SlotPos[i].transform.position){ * EmptySlot = false; * break; * } * } * if(EmptySlot){ * HoldingObj.transform.position = Pia.SlotPos[i].transform.position; * } * } * } */ } }
public void PlacePhone(Interacao_Telefone phone) { phone.transform.SetParent(transform); phone.transform.localPosition = PhonePos; phone.onBase = true; }