public IEnumerator SetupMatch() { while (NetworkMatchSetup.HasAllMatchSetupInfo() == false) { //Spin until we have all the match setup info that we need to start the match yield return(null); } while (NetworkMatchSender.Get() == null) { //Spin until the needed networking objects have been spawned and given a chance to initialize // - in particular, the NetworkMatchSender needs to be ready in case we need to immediately send inputs // as part of initializing the match (like for loading a log file) yield return(null); } Debug.Log("Starting match initializations since we have enough information"); ContRandomization.Get().InitGenerator(NetworkMatchSetup.GetRandomizationSeed()); Debug.Log("Finished initializing the randomizer"); InitPlayers(nPlayers); Debug.Log("Finished initializing players"); //Initialize characters InitAllChrs(); Debug.Log("After InitAllChrs"); //Assign local input controllers for each player AssignAllLocalInputControllers(); Debug.Log("After assigning local input controllers"); ContManaDistributer.Get().InitializeRandomReserves(); Debug.Log("After initializing mana reserves"); InitAllChrPositions(); Debug.Log("After initializing positions"); //ContPositions.Get().PrintAllPositions(); ContTurns.Get().InitializePriorities(); Debug.Log("After InitializePriorities"); //Check if the LogManager wants to load in any starting inputs LogManager.Get().LoadStartingInputs(); Debug.Log("After LoadStartingInputs"); LogManager.Get().InitMatchLog(); Debug.Log("Finished initializing the log file"); }
public void RandomizePlayerReserves(int iPlayer) { Mana.MANATYPE swap; for (int i = 0; i < NRANDOMRESERVELENGTH; i++) { swap = arManaRandomReserves[iPlayer, i]; //Note that we have to use a standardized randomization source so that every player will simulate with the same randomization int iRandomIndex = ContRandomization.Get().GetRandom(0, NRANDOMRESERVELENGTH); arManaRandomReserves[iPlayer, i] = arManaRandomReserves[iPlayer, iRandomIndex]; arManaRandomReserves[iPlayer, iRandomIndex] = swap; } }