This is not optimized to be pooling, I recommend pooling your bullets rather than destroying it like so
Inheritance: MonoBehaviour
示例#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;
            }
        }
    }
示例#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;
            }
        }
    }