void PopulateObjectLists() { //Load Story NPCS. StoryNPC.LoadStoryNPCs(); //Load Filler NPCS. FillerNPC.LoadStoryNPCs(); //Load in Filler carriages. _fillerCarriages.Add(Resources.Load <GameObject>("Carriages/FillerCarriage1")); CogPuzzle.Load3DPuzzlePrefabs(); }
public void PlaceCarriageNPC(StoryNPC npc) { GameObject newNPC = (GameObject)Instantiate(npc.ModelPrefab, NPCPosition.position, NPCPosition.rotation); StoryNPC newStoryNPC = newNPC.AddComponent <StoryNPC>(); newStoryNPC.Name = npc.Name; newStoryNPC.MemoryItemKey = npc.MemoryItemKey; newStoryNPC.MemoryResponseTotal = npc.MemoryResponseTotal; newStoryNPC.InitialDialogueNodeKey = npc.InitialDialogueNodeKey; newStoryNPC.Health = npc.Health; newStoryNPC.Interactable = npc.Interactable; newStoryNPC.NPCDeath += OnNPCDeath; newStoryNPC.EnablePuzzlesNode = npc.EnablePuzzlesNode; newStoryNPC.EnablePuzzles += ShowPuzzles; newStoryNPC.NPCDeath += OnNPCDeath; newStoryNPC.transform.parent = transform; }
private StoryNPC SelectStoryNPC() { int counter = 0; int rand; counter++; StoryNPC toreturn = null; if (StoryNPC.StoryNPCs.Count == 0) { Debug.LogError("Story NPC list is empty"); return(null); } while (true) { counter++; if (StoryNPC.StoryNPCs.Count == 1) { rand = 0; } else { rand = random.Next(0, StoryNPC.StoryNPCs.Count); } toreturn = StoryNPC.StoryNPCs[rand]; if (!_carriageNPCs.Contains(toreturn)) { _carriageNPCs.Add(toreturn); break; } //Accept this npc as we only have 1 to use. else if (StoryNPC.StoryNPCs.Count <= 1) { _carriageNPCs.Add(toreturn); break; } } return(toreturn); }
public void Deserialise() { StoryNPC npc = _storyNPCSerialiser.DeserialiseXML(new System.IO.FileInfo(Application.streamingAssetsPath + @"\StoryNPC.xml")); }