void InitializePlayers()
        {
            SpawnController.InitializeStartPoints();

            for (int i = 0; i < MatchSettings.currentMatchSettings.playersSettings.Count; i++)
            {
                var currentPlayerSettings = MatchSettings.currentMatchSettings.playersSettings[i];

                Player player = new Player(currentPlayerSettings.color);
                player.teamIndex       = currentPlayerSettings.team;
                player.selectedFaction = currentPlayerSettings.selectedFaction;
                player.isAIPlayer      = currentPlayerSettings.isAI;

                if (mapSettings.isThisMapForSingleplayer)
                {
                    player.money = currentPlayerSettings.startMoneyForSingleplayer;
                }
                else
                {
                    player.money = MainStorage.startPlayerMoney;
                }

                playersController.AddPlayer(player);
            }

            if (MapSettings.autoSpawnPlayerStabs)
            {
                for (int i = 0; i < playersController.playersIngame.Count; i++)
                {
                    SpawnController.SpawnPlayerStab((byte)i);
                }
            }
        }
Exemplo n.º 2
0
        void SpawnCurrentUnit(UnitData unitData)
        {
            var spawnedUnit = SpawnController.SpawnUnit(unitData, selfUnit.OwnerPlayerId, spawnPoint);

            if (spawnedUnit.GetComponent <Harvester>())            // resource harvesters have their own code to move to the resource field.
            {
                return;
            }

            var order = new MovePositionOrder
            {
                movePosition = moveWaypoint.position
            };

            if (unitData.moveType == UnitData.MoveType.Flying)
            {
                order.movePosition += new Vector3(Random.Range(-3f, 3f), 0f, Random.Range(-3f, 3f));
            }

            spawnedUnit.AddOrder(order, false);

            ShuffleUnitsOnExit(order.movePosition, selfUnit);
        }
Exemplo n.º 3
0
        void SpawnHarvester()
        {
            var spawnedHarvester = SpawnController.SpawnUnit(harversterUnitData, selfUnit.OwnerPlayerId, carryOutResourcesPoint);

            spawnedHarvester.GetComponent <Harvester>().SetRefinery(this);
        }