예제 #1
0
파일: Map.cs 프로젝트: Tatheon/Task-1
        public void WorldBuild()
        {
            for (int i = 0; i < numUnits; i++)//creates the player types and randomizes their positions
            {
                if (r.Next(2) == 0)
                {
                    players[i] = new Ranged(r.Next(1, 20), r.Next(0, 20), teams[r.Next(2)]);// make a Ranged Boi
                }
                else
                {
                    players[i] = new Melee(r.Next(1, 20), r.Next(0, 20), teams[r.Next(2)]);// make a melee Boi
                }
            }

            UpdateWorld();
        }
예제 #2
0
        public void WorldBuild()
        {
            for (int i = 0; i < players.Length; i++)//creates the player types and randomizes their positions
            {
                int unitType = r.Next(3);
                if (unitType == 0)
                {
                    players[i] = new Ranged(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]);   // make a Ranged Boi
                }
                else if (unitType == 1)
                {
                    players[i] = new Melee(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]);   // make a melee Boi
                }
                else
                {
                    players[i] = new Wizzard(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[2]);  // make a wizard Boi
                }
            }

            for (int i = 0; i < buildings.Length; i++)//creates the building types and randomizes their positions
            {
                if (r.Next(2) == 0)
                {
                    int yValue = r.Next(1, mapHeight);
                    int SpawnVal;
                    if (yValue == 0)
                    {
                        SpawnVal = -1;
                    }
                    else
                    {
                        SpawnVal = 1;
                    }

                    buildings[i] = new FactoryBuilding(r.Next(1, mapWidth), yValue, teams[r.Next(2)], SpawnVal);//make a factory
                }
                else
                {
                    buildings[i] = new ResourceBuilding(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]);//make a recource building
                }
            }

            UpdateWorld();
        }
예제 #3
0
파일: Map.cs 프로젝트: Tatheon/Task-2
        public void WorldBuild()
        {
            for (int i = 0; i < players.Length; i++)//creates the player types and randomizes their positions
            {
                if (r.Next(2) == 0)
                {
                    players[i] = new Ranged(r.Next(1, mapSize), r.Next(0, mapSize), teams[r.Next(2)]);
                }
                else
                {
                    players[i] = new Melee(r.Next(1, mapSize), r.Next(0, mapSize), teams[r.Next(2)]);
                }
            }

            for (int i = 0; i < buildings.Length; i++)//creates the player types and randomizes their positions
            {
                if (r.Next(2) == 0)
                {
                    int yValue = r.Next(1, mapSize);
                    int SpawnVal;
                    if (yValue == 0)
                    {
                        SpawnVal = -1;
                    }
                    else
                    {
                        SpawnVal = 1;
                    }

                    buildings[i] = new FactoryBuilding(r.Next(1, mapSize), yValue, teams[r.Next(2)], SpawnVal);
                }
                else
                {
                    buildings[i] = new ResourceBuilding(r.Next(1, mapSize), r.Next(1, mapSize), teams[r.Next(2)]);
                }
            }

            UpdateWorld();
        }