public void AddVillager(VillagerDialogue villager) { //Debug.Log(villager.ToString()); //Debug.Log(villagers.ToString()); if (index < villagers.Length) { villagers[index] = villager; villager.idnum = index; index++; } else { VillagerDialogue[] temp = new VillagerDialogue[villagers.Length * 2]; bool[] bools = new bool[helped.Length * 2]; villagers.CopyTo(temp, 0); villagers = temp; helped.CopyTo(bools, 0); helped = bools; for (int i = index; i < helped.Length; i++) { helped[i] = false; } AddVillager(villager); } }
//Spawns a villager with a random dialogue at a random spawn point public void SpawnVillager() { Vector3 spawn = spawnPoints[Random.Range(0, spawnPoints.Length - 1)].transform.localPosition; int prefab = Random.Range(0, spawnPoints.Length - 1); VillagerDialogue npc = npcPrefabs[prefab]; VillagerDialogue villager = Instantiate(npc) as VillagerDialogue; villager.gameObject.transform.localPosition = spawn; villager.prefab = prefab; int index = Random.Range(0, dialogues.Length - 1); villager.currentDialogue = dialogues[index]; villager.response = responses[index]; villager.dialogueNum = index; manager.AddVillager(villager); villager.manager = manager; }
//Unfinished: Need to work with Life Task/Journal system public void Respawn(int prefab, int dialogue, bool helped) { Vector3 spawn = spawnPoints[Random.Range(0, spawnPoints.Length - 1)].transform.localPosition; VillagerDialogue npc = npcPrefabs[prefab]; VillagerDialogue villager = Instantiate(npc) as VillagerDialogue; villager.gameObject.transform.localPosition = spawn; villager.prefab = prefab; villager.response = responses[dialogue]; villager.endDialogue = endDialogue; if (helped) { villager.currentDialogue = endDialogue; } else { villager.currentDialogue = dialogues[dialogue]; } }
public void AddVillager(VillagerDialogue villager) { //Debug.Log(villager.ToString()); //Debug.Log(villagers.ToString()); if(index < villagers.Length) { villagers[index] = villager; villager.idnum = index; index++; } else { VillagerDialogue[] temp = new VillagerDialogue[villagers.Length*2]; bool[] bools = new bool[helped.Length*2]; villagers.CopyTo(temp,0); villagers = temp; helped.CopyTo(bools,0); helped = bools; for (int i=index;i<helped.Length;i++) { helped[i] = false; } AddVillager(villager); } }
public void setHelped(VillagerDialogue villager) { helped[villager.idnum] = true; villager.Test(); }
public void setVillager(VillagerDialogue set) { villager = set; }
public void setVillager(VillagerDialogue set) { villager = set; }
public void setHelped(VillagerDialogue villager) { helped[villager.idnum] = true; villager.Test(); }