async Task PrepArmySoldiers() { // wait for signal to allow RoundWon signal to process in Combat.cs firstx` await ToSignal(GetTree().CreateTimer(0.1f), "timeout"); CityInfoResource currentCity = CityInfo.Instance.currentCity; // make the amount of soldiers specified for this round int newSoldiersThisRound = currentCity.numSoldiersPerRound[CombatInfo.Instance.currentRound - 1]; for (int i = 0; i < newSoldiersThisRound; i++) { Enums.ArmyGunTypes gunType = currentCity.soldierGunTypes[soldierNum]; int zoneIndex = currentCity.soldierZoneIndex[soldierNum]; CombatArmyZone zoneToDeployTo = armyZones[zoneIndex]; // for each zone, both: // 1. add it to the list which is used by the deploy function // 2. and prepare the soldiers in that zone zonesToDeployTo.Add(zoneToDeployTo); await zoneToDeployTo.PrepArmySoldier(soldierNum, gunType); soldierNum++; zoneLastDeployedTo = zoneToDeployTo; } }
public void Reset() { CityInfoResource currentCity = CityInfo.Instance.currentCity; selectedDinoType = Enums.Dinos.Mega; dinosDeploying.Clear(); selectorTimerList.Clear(); abilitiesUsed.Clear(); lanesInDanger.Clear(); currentRound = 1; maxRounds = currentCity.rounds; creds = currentCity.roundWinCreditBonus[0]; allMoneyExpended = false; }
public override void _Ready() { Instance = this; biomeFavoredDinos = new Dictionary <Enums.Biomes, List <Enums.Dinos> >() { { b.Desert, new List <d>() { d.None } }, { b.Forest, new List <d>() { d.None } }, { b.Grassland, new List <d>() { d.None } }, { b.Hills, new List <d>() { d.None } }, { b.Oceanside, new List <d>() { d.Gator } }, { b.River, new List <d>() { d.Gator } }, }; biomeRestrictedDinos = new Dictionary <Enums.Biomes, List <Enums.Dinos> >() { { b.Desert, new List <d>() { d.Gator } }, { b.Forest, new List <d>() { d.None } }, { b.Grassland, new List <d>() { d.None } }, { b.Hills, new List <d>() { d.None } }, { b.Oceanside, new List <d>() { d.None } }, { b.River, new List <d>() { d.None } }, }; ////////////////////// // load the CityInfoResource files ////////////////////// string infoDirectory = "res://src/combat/levelsInfo/"; // go through the levelsInfo directory and add each filename to a list // that list is then used to construct filepaths to load all the resources var filesList = new List <string>(); Directory dir = new Directory(); dir.Open(infoDirectory); dir.ListDirBegin(true); while (true) { var file = dir.GetNext(); if (file == "") { dir.ListDirEnd(); break; } else { filesList.Add(file); } } foreach (string s in filesList) { citiesList.Add(GD.Load <CityInfoResource>(infoDirectory + s)); } // TODO: remove this when we have a Map system done to select cities and then attack those currentCity = citiesList[0]; }