Наследование: UnityEngine.MonoBehaviour
Пример #1
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;
        }
Пример #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;
        }