Initialize() 공개 메소드

public Initialize ( ) : void
리턴 void
예제 #1
0
        internal int SummonNpc(NpcToSummon summonParameters)
        {
            NpcMonster npcMonster = ServerManager.GetNpc(summonParameters.VNum);

            if (npcMonster != null)
            {
                MapNpc mapNpc = new MapNpc
                {
                    NpcVNum       = npcMonster.NpcMonsterVNum,
                    MapY          = summonParameters.SpawnCell.X,
                    MapX          = summonParameters.SpawnCell.Y,
                    MapId         = Map.MapId,
                    IsHostile     = false,
                    IsMoving      = summonParameters.Move,
                    MapNpcId      = GetNextNpcId(),
                    Target        = summonParameters.Target,
                    OnDeathEvents = summonParameters.DeathEvents,
                    IsMate        = summonParameters.IsMate,
                    IsProtected   = summonParameters.IsProtected
                };
                mapNpc.Initialize(this);
                AddNPC(mapNpc);
                Broadcast(mapNpc.GenerateIn());
                return(mapNpc.MapNpcId);
            }
            return(default);
예제 #2
0
 public void LoadNpcs()
 {
     foreach (MapNpcDTO npc in DAOFactory.MapNpcDAO.LoadFromMap(Map.MapId).ToList())
     {
         MapNpc np = npc as MapNpc;
         np.Initialize(this);
         _npcs[np.MapNpcId] = np;
         _mapNpcIds.Add(np.MapNpcId);
     }
 }
예제 #3
0
 public void LoadNpcs()
 {
     Parallel.ForEach(DAOFactory.MapNpcDAO.LoadFromMap(Map.MapId).ToList(), npc =>
     {
         MapNpc mapNpc = new MapNpc(npc);
         mapNpc.Initialize(this);
         int mapNpcId         = mapNpc.MapNpcId;
         _npcs[mapNpcId]      = mapNpc;
         _mapNpcIds[mapNpcId] = mapNpcId;
     });
 }
예제 #4
0
        public void LoadNpcs()
        {
            var partitioner = Partitioner.Create(DAOFactory.MapNpcDAO.LoadFromMap(Map.MapId), EnumerablePartitionerOptions.None);

            Parallel.ForEach(partitioner, npc =>
            {
                MapNpc mapNpc = npc as MapNpc;
                mapNpc.Initialize(this);
                int mapNpcId    = mapNpc.MapNpcId;
                _npcs[mapNpcId] = mapNpc;
                _mapNpcIds.Add(mapNpcId);
            });
        }
예제 #5
0
        internal List <int> SummonNpcs(List <NpcToSummon> summonParameters)
        {
            List <int> ids = new List <int>();

            foreach (NpcToSummon mon in summonParameters)
            {
                NpcMonster npcmonster = ServerManager.Instance.GetNpc(mon.VNum);
                if (npcmonster != null)
                {
                    MapNpc npc = new MapNpc {
                        NpcVNum = npcmonster.NpcMonsterVNum, MapY = mon.SpawnCell.X, MapX = mon.SpawnCell.Y, MapId = Map.MapId, IsHostile = true, IsMoving = true, MapNpcId = GetNextNpcId(), Target = mon.Target, OnDeathEvents = mon.DeathEvents, IsMate = mon.IsMate, IsProtected = mon.IsProtected
                    };
                    npc.Initialize(this);
                    AddNPC(npc);
                    Broadcast(npc.GenerateIn());
                    ids.Add(npc.MapNpcId);
                }
            }

            return(ids);
        }