void SpawnNPC(GameObject _prefab) { ProgressTracker.instance.Spawned += 1; spawns++; GameObject newObject = (GameObject)Instantiate(_prefab); newObject.transform.position = transform.position; NPCZombie zombieScript = newObject.GetComponent <NPCZombie>(); NPCHumanoidRobot robotScript = newObject.GetComponent <NPCHumanoidRobot>(); if (zombieScript != null) { zombieScript.destinations = destinations; if (ProgressTracker.instance.spawned == ProgressTracker.instance.waveEmemyCount) { zombieScript.lastSpawn = true; } } if (robotScript != null) { robotScript.destinations = destinations; if (ProgressTracker.instance.spawned == ProgressTracker.instance.waveEmemyCount) { robotScript.lastSpawn = true; } } _audio.clip = spawnSound; _audio.Play(); }
public void Awake() { navMeshAgent = GetComponent <NavMeshAgent>(); Debug.Log("manager = " + WaypointsManager.GetWaypointsManager()); humanScript = GetComponent <NPCHuman>(); zombieScript = GetComponent <NPCZombie>(); if (isZombie) { humanScript.enabled = false; zombieScript.enabled = true; } else { humanScript.enabled = true; zombieScript.enabled = false; } }
// Use this for initialization void Start() { zombie = GetComponent <NPCZombie>(); }