// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerStay(Collider other) { // If the other collider is the player if (other.gameObject.tag == Tags.playerTag) { // If the player presses action saves civillian if (other.gameObject.GetComponent <PlayerController>().IsAction()) { // Set the civillian stats GameDataManager.instance.SetCivillianStats(transform.position, false, true); // Add the civillian to the hud hud.AddCivillian(civillianHUDItem); // Play sound fx and particles - destroy gameobject questManager.PlaySFX(); ParticleSystemController.InstaniateParticleSystem(savedCivillian, transform.position, Quaternion.identity); Destroy(gameObject); } // Player kills civillian else if (other.gameObject.GetComponent <PlayerController>().IsDiggingAttacking()) { // Set the civillian stats GameDataManager.instance.SetCivillianStats(transform.position, true, false); // Set the rotation Quaternion rotation = Quaternion.identity; rotation.eulerAngles = new Vector3(0.0f, 0.0f, 90.0f); // Play sound fx and particles - destroy gameobject questManager.PlaySFX(killedClip); ParticleSystemController.InstaniateParticleSystem(killedCivillian, transform.position, rotation); Destroy(gameObject); } } }