void DropPresent() { pressie.drop(); if (pressie.getHouse()) { pressie.getHouse().OnPressieDrop(); } pressie = null; }
void PickupPresent(Pressie pressie) { pressie.pickUp(this, pressiePoint); this.pressie = pressie; if (pressie.getHouse()) { pressie.getHouse().OnPressieCollect(this); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "pressie" && pressie == null) { Pressie p = collision.gameObject.GetComponent <Pressie>(); if (p.owner != null) { print("DROP IT!"); p.owner.DropPresent(); } PickupPresent(p); } }
private void OnTriggerEnter(Collider other) { print("HIT " + other.gameObject); if (pressie != null && other.transform.position == pressie.getHouse().transform.position) { print("IS OUR GUY"); Pressie thePressie = pressie; pressie.getHouse().SatifyGoal(); DropPresent(); score += 1; onPointScore.Invoke(); Destroy(thePressie.gameObject); } }