void Update() { if (Physics.Raycast(transform.position, transform.forward, out hit, maxDistance, ~ignoreLayer)) { if (decalHitWall) { if (hit.transform.tag == "LevelPart") { Instantiate(decalHitWall, hit.point + hit.normal * floatInfrontOfWall, Quaternion.LookRotation(hit.normal)); Destroy(gameObject); } if ((hit.transform.tag == "Target 1") || (hit.transform.tag == "Target 2") || (hit.transform.tag == "Target 3")) { Instantiate(decalHitWall, hit.point + hit.normal * floatInfrontOfWall, Quaternion.LookRotation(hit.normal)); GM.FinishQuest(hit.transform.tag); Destroy(gameObject); Debug.Log("hit"); } } Destroy(gameObject); } Destroy(gameObject, 0.1f); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Pick Up1") || other.gameObject.CompareTag("Pick Up2") || other.gameObject.CompareTag("Pick Up3")) { other.gameObject.SetActive(false); GM.FinishQuest(other.gameObject.tag); if (GM.AreQuestsFinished()) { SetQuest1Text } } }