когда я убиваю ОДНОГО зомби убиваются все пачиму?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletDestroy : MonoBehaviour
{
void Update()
{
Destroy(gameObject, 10f);
}
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Zombie")
{
Zombie.zHP -= 10;
Destroy(gameObject);
}
if (other.gameObject.tag == "Player")
{
Destroy(gameObject);
}
Destroy(gameObject);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Zombie : MonoBehaviour
{
public NavMeshAgent navMesh;
public Animator anim;
public Transform player;
public static int zHP = 200;
void Start()
{
}
void Update()
{
navMesh.SetDestination(player.transform.position);
if (zHP == 0)
{
Destroy(this.gameObject);
}
}
}