コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }