private void OnTriggerEnter(Collider other) { m_lifeTime += Time.deltaTime; if (other.CompareTag("Player")) { Player player = other.GetComponent <Player>(); PlayerFireScript playerFireScript = other.GetComponent <PlayerFireScript>(); if (player.m_playerID == m_shooterID && !m_isLethal) { // collision with the player who shot it playerFireScript.m_currentProjectiles++; Destroy(gameObject); // destroy projectile } else if (player.m_playerID != m_shooterID && m_isLethal) { PlayerManager.Instance.m_players.Remove(other.gameObject); ParticleSystem bloodParticle = Instantiate(m_bloodParticle); bloodParticle.transform.position = other.transform.position; Destroy(other.gameObject); } } else if (!other.CompareTag("Projectile")) { GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; m_isLethal = false; // set bullet to non-lethal } }
// Use this for initialization void Start() { m_playerFireScript = GetComponent <PlayerFireScript>(); }