예제 #1
0
        //
        // GameEncounterPoint
        //
        public EncounterPoint(World world, GameClient client, Type monsterType, int numMonsters, Vector3D position)
        {
            ObjectIdsSpawned = new List<Monster>();
            _client = client;

            numMonsters += RandomHelper.Next(3);

            for (int i = 0; i < numMonsters; i++)
            {
                // Allocate the monster with the world.
                Monster monster = (Monster)world.SpawnNPC(monsterType);

                // Random spawn offset.
                float xpos = (float)(RandomHelper.NextDouble() * 20);
                float ypos = (float)(RandomHelper.NextDouble() * 20);
                
                // Init the monster and set the position with the randomized coordinates.
                monster.Init(_client.GetNextValidObjectID(), ref client);
                monster.SetPosition(position.Field0 + xpos, position.Field1 + ypos, position.Field2);

                // Spawn the monster.
                world.SpawnMob(client, monster.Position, monster);

                System.Threading.Thread.Sleep(15); // Required to not generate the same random value twice...

                ObjectIdsSpawned.Add(monster);
            }
        }
예제 #2
0
파일: Universe.cs 프로젝트: yabizz/d3sharp
        World GetWorld(int WorldID)
        {
            for (int x = 0; x < Worlds.Count; x++)
                if (Worlds[x].WorldID == WorldID) return Worlds[x];

            World w = new World(WorldID);
            Worlds.Add(w);
            return w;
        }
예제 #3
0
        public World GetWorld(int WorldID)
        {
            for (int x = 0; x < _worlds.Count; x++)
                if (_worlds[x].WorldID == WorldID) return _worlds[x];

            var world = new World(WorldID);
            _worlds.Add(world);
            return world;
        }       
예제 #4
0
 public GameClient(IConnection connection)
 {
     this.Connection = connection;
     _outgoingBuffer.WriteInt(32, 0);
     GameWorld = new World(this);
 }