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 == "Dummie1") || (hit.transform.tag == "Dummie2") || (hit.transform.tag == "Dummie3")) { Instantiate(decalHitWall, hit.point + hit.normal * floatInfrontOfWall, Quaternion.LookRotation(hit.normal)); GM.FinishQuest(hit.transform.tag); Destroy(gameObject); Debug.Log("hit"); } if (hit.transform.tag == "Win") { Instantiate(decalHitWall, hit.point + hit.normal * floatInfrontOfWall, Quaternion.LookRotation(hit.normal)); GM.ShootEnd(); } } Destroy(gameObject); } Destroy(gameObject, 0.1f); }