private void OnTriggerEnter(Collider other) { if (other.gameObject.tag != "NPCLCALL") { door.SetActive(false); Resoucres.CheckEndPoint(); } }
private void OnTriggerStay(Collider other) { switch (other.tag) { case "upgrade": if (Resoucres.grant > 0) { if (m_Fire1) { other.GetComponentInParent <Building>().Buy(other.GetComponent <SignBuild>().Build); Resoucres.grant = Resoucres.grant - other.GetComponent <SignBuild>().Cost; other.gameObject.SetActive(false); m_Fire1 = false; if (other.GetComponent <SignBuild>().ToUnlockBuild != null) { other.GetComponent <SignBuild>().ToUnlockBuild.SetActive(true); } other.GetComponentInParent <Building>().helpBuy.gameObject.SetActive(false); } } break; case "boat": if (m_Fire1) { m_Boating = !m_Boating; Debug.Log(boat.transform.parent); if (boat.transform.parent == null) { boat.transform.SetParent(this.transform); } else { boat.transform.SetParent(null); } m_Fire1 = false; } break; case "plastic": if (m_Fire1 && m_Hand.transform.childCount == 0) { other.gameObject.transform.SetParent(m_Hand.transform); other.gameObject.transform.position = m_Hand.transform.position; m_Fire1 = false; } break; case "paper": if (m_Fire1 && m_Hand.transform.childCount == 0) { other.gameObject.transform.SetParent(m_Hand.transform); other.gameObject.transform.position = m_Hand.transform.position; m_Fire1 = false; } break; case "glass": if (m_Fire1 && m_Hand.transform.childCount == 0) { other.gameObject.transform.SetParent(m_Hand.transform); other.gameObject.transform.position = m_Hand.transform.position; m_Fire1 = false; } break; case "glassBin": if (m_Fire1 && m_Hand.transform.childCount == 1 && m_Hand.transform.GetChild(0).gameObject.tag == "glass") { Destroy(m_Hand.transform.GetChild(0).gameObject); Resoucres.glassValue++; Resoucres.ChcekIfCollectAll(); m_Fire1 = false; } break; case "papperBin": if (m_Fire1 && m_Hand.transform.childCount == 1 && m_Hand.transform.GetChild(0).gameObject.tag == "paper") { Destroy(m_Hand.transform.GetChild(0).gameObject); Resoucres.paperValue++; Resoucres.ChcekIfCollectAll(); m_Fire1 = false; } break; case "plasticBin": if (m_Fire1 && m_Hand.transform.childCount == 1 && m_Hand.transform.GetChild(0).gameObject.tag == "plastic") { Destroy(m_Hand.transform.GetChild(0).gameObject); Resoucres.plasticValue++; Resoucres.ChcekIfCollectAll(); m_Fire1 = false; } break; case "NPCL": if (m_Fire1) { other.GetComponent <NPCL>().isFollow = !other.GetComponent <NPCL>().isFollow; if (other.GetComponent <NPCL>().isFollow == true) { other.GetComponentInChildren <SpriteRenderer>().sprite = GameObject.Find("Resoucers").GetComponent <Resoucres>().labNPCStatusSpirtes[1]; } else { other.GetComponentInChildren <SpriteRenderer>().sprite = GameObject.Find("Resoucers").GetComponent <Resoucres>().labNPCStatusSpirtes[0]; } m_Fire1 = false; } break; case "NPCLCALL": if (m_Fire2) { other.GetComponentInParent <NPCL>().isFollow = !other.GetComponentInParent <NPCL>().isFollow; if (other.GetComponentInParent <NPCL>().isFollow == true) { other.GetComponentInParent <NPCL>().GetComponentInChildren <SpriteRenderer>().sprite = GameObject.Find("Resoucers").GetComponent <Resoucres>().labNPCStatusSpirtes[1]; } else { other.GetComponentInParent <NPCL>().GetComponentInChildren <SpriteRenderer>().sprite = GameObject.Find("Resoucers").GetComponent <Resoucres>().labNPCStatusSpirtes[0]; } m_Fire2 = false; } break; case "NPCSchool": SchoolBrief school = GameObject.Find("Resoucers").GetComponent <Resoucres>().schoolBrief; if (m_Fire1 && other.GetComponent <Student>().needHelp == true && (school.gameObject.active == false)) { school.SetBrief(other.GetComponent <Student>()); m_Fire1 = false; } break; case "NPCTech": if (m_Fire1 && other.GetComponent <Teching>().startHelpping == false && GameObject.Find("Resoucers").GetComponent <Resoucres>().schoolBrief.dzialania.Count == 7) { other.GetComponent <Teching>().startHelpping = true; other.GetComponent <Teching>().Rutine(); m_Fire1 = false; } break; case "NPCHelp": { if (m_Fire1) { if (other.GetComponent <Helper>().textInut.gameObject.active == false) { other.GetComponent <Helper>().textInut.gameObject.SetActive(true); } else { other.GetComponent <Helper>().textInut.gameObject.SetActive(false); } other.GetComponent <Helper>().textInut.text = other.GetComponent <Helper>().textValue; m_Fire1 = false; } } break; } }