Ejemplo n.º 1
0
        public void SetWoods(ServerDispatcher disp)
        {
            SendData data = new SendData();

            data.clientId = "";
            for (int i = woodStart; i < woodEnd; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    data.position = Map.map.GetTileByMapCoordinates(j, i).LocalPosition;
                    if (rnd.NextDouble() <= obstacleFrequency)
                    {
                        data.creating = "Rock";
                        disp.CreateAndSync(data);
                    }
                    if (rnd.NextDouble() <= emptyFrequency)
                    {
                    }
                    else
                    {
                        data.creating = "Tree";
                        disp.CreateAndSync(data);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SetPlayer(ServerDispatcher disp, Player p, int playerNum, int maxPlayers)
        {
            SendData data = new SendData();

            data.clientId = p.Owner.Name.Substring(6);
            PopulateInitialPosition initial = PopulateInitialPosition.GetPlayerPosition(playerNum, maxPlayers,
                                                                                        width, height, castleWidth, castleHeight);
            int x = initial.x;
            int y = initial.y;


            data.position = Map.map.GetTileByMapCoordinates(x, y).LocalPosition;
            data.creating = "Castle";
            disp.CreateAndSync(data);

            //create person
            data.creating = "Person";
            for (int i = 0; i < personNum; i++)
            {
                data.position = Map.map.GetTileByMapCoordinates(x + i, y).LocalPosition;
                disp.CreateAndSync(data);
            }
        }
Ejemplo n.º 3
0
        public void SetRiver(ServerDispatcher disp)
        {
            SendData data = new SendData();

            data.clientId = "";
            for (int i = (height - riverSize) / 2; i < (height + riverSize) / 2; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    data.position = Map.map.GetTileByMapCoordinates(j, i).LocalPosition;
                    data.creating = "Water";
                    disp.CreateAndSync(data);
                }
            }
        }