void Awake() { moveSpeed = Random.Range(minSpeed, maxSpeed); cultistFaith = Mathf.RoundToInt(Random.Range(0, 100f)); cultistAge = Mathf.RoundToInt(Random.Range(1, 85f)); cultistProperties = new CultistProperties(0, 0, "apple", cultistAge, cultistFaith); }
IEnumerator Spawn() { int count = 0; while (count < cultistsToSpawn) { GameObject obj = Instantiate(cultistData.cultistPrefab, gameObject.transform); CultistProperties prop = obj.GetComponent <CultistController>().cultistProperties; cultistManager.CultistList.Add(obj); cultistData.CultistPropertiesList.Add(prop); cultistData.totalNumberOfCultists++; Transform child = transform.GetChild(Random.Range(0, LastZoneTransform.GetSiblingIndex())); obj.GetComponent <WaypointNavigator>().currentWaypoint = child.GetComponent <Waypoint>(); obj.transform.position = child.position; yield return(new WaitForEndOfFrame()); count++; } }