This is not optimized to be pooling, I recommend pooling your bullets rather than destroying it like so
Inheritance: MonoBehaviour
Exemple #1
0
    public void Damage(ForgeZombieBullet bullet)
    {
        if (bullet != null)
        {
            if (OwningNetWorker.IsServer) // Only the server cares about the damage
                Health -= bullet.BulletDamage;

            if (Health < 35)
            {
                _thisRenderer.material.color = Color.red;
            }
        }
    }
Exemple #2
0
    public void Damage(ForgeZombieBullet bullet)
    {
        if (bullet != null)
        {
            if (!NetworkingManager.IsOnline || OwningNetWorker.IsServer)             // Only the server cares about the damage
            {
                Health -= bullet.BulletDamage;
            }

            if (Health < 35)
            {
                _thisRenderer.material.color = Color.red;
            }
        }
    }