public void SpawnDummyNPC(string pNPCID, Vector2 pPosition, string pFacing) { NPCData NPC = GetNPCDummy(pNPCID); print(NPC.NPCID); NPCData newNPC = Instantiate <NPCData>(NPC, pPosition, transform.rotation); CharacterDirection facing = (CharacterDirection)System.Enum.Parse(typeof(CharacterDirection), pFacing); newNPC.GetComponent <AnimationController>().ChangeFacing(facing); SpawnedDummyNPCs.Add(newNPC); }
public void SpawnEventNPCs(List <EventNPCLocation> pNPCs) { EventNPCs.Clear(); foreach (EventNPCLocation npc in pNPCs) { NPCData newNPC = Instantiate(GetNPCDummy(npc.NPCID), npc.Position, transform.rotation); newNPC.GetComponent <AnimationController>().ChangeFacing(npc.Facing); EventNPCs.Add(newNPC.gameObject); } }
public void SpawnNPCInLevel(string pNPCID, Vector2 pPosition, string pFacing, bool UpdateDataLocation = false) { NPCData NPC = GetNPC(pNPCID); foreach (NPCData npc in SpawnedNPCs) { if (npc.NPCID == NPC.NPCID) { return; } } NPCData newNPC = Instantiate <NPCData>(NPC, pPosition, transform.rotation); CharacterDirection facing = (CharacterDirection)System.Enum.Parse(typeof(CharacterDirection), pFacing); newNPC.GetComponent <AnimationController>().ChangeFacing(facing); SpawnedNPCs.Add(newNPC); // print("Spawning: " + newNPC.NPCID); if (UpdateDataLocation) { ChangeNPCDataLocation(pNPCID, SceneManager.GetActiveScene().name, pPosition); } }