예제 #1
0
            public void RemoveGameEntity(string entityId, string characterId, int shortId)
            {
                IGameEntity entity = gameEntities[entityId];

                gameEntities.Remove(entityId);
                characters.Remove(characterId);
                characterToEntityId.Remove(characterId);
                shortIdToEntityId.Remove(shortId);
                Destroy(entity.GetGameObject());
                //Debug.Log("Remove " + entityId + " " + characterId);
            }
예제 #2
0
        private void CreateNpc(NpcGroup group, NpcDef npcDef, Character character, int order)
        {
            Vector3     spawnPosition = SpawnPoint.Instance().GetObjectSpawnPoint(gameObject);
            GameObject  prefab        = GameEntityFactory.instance.GetGameEntityPrefab(npcDef.prefabName);
            IGameEntity gameEntity    = CreateGameEntity(character.playerId, character, spawnPosition, prefab);
            Npc         npc           = gameEntity.GetGameObject().AddComponent <Npc>() as Npc;

            npc.group      = group;
            npc.gameEntity = gameEntity;

            if (order == 0)
            {
                group.SetLeader(npc);
            }
            npc.order = order;
            npc.SetNpcDef(npcDef);
            group.AddNpc(npc);
            gameEntities.Add(gameEntity);
            characterIdToGameEntity[character.id]          = gameEntity;
            entityIdToGameEntity[gameEntity.GetEntityId()] = gameEntity;
        }