public void ChooseMiniGame(string gameType) // clicked on a drop-down sub-button: { DebugBot.DebugFunctionCall("TMiniGameUI; ChooseMiniGame(" + gameType + "); ", debugFunctionCalls); Player currentPlayer = trainerModuleScript.gameController.masterTrainer.PlayerList[trainerModuleScript.gameController.masterTrainer.CurPlayer - 1]; if (currentPlayer.masterTrialsList.Count - 1 < currentPlayer.currentTrialForEdit) // if trialsList doesn't have an entry for current Index { DebugBot.DebugFunctionCall("TMiniGameUI; Index out of RANGE!; ", debugFunctionCalls); } else // TrialsList has a valid entry: { MiniGameManager.MiniGameType parsed_enum = (MiniGameManager.MiniGameType)System.Enum.Parse(typeof(MiniGameManager.MiniGameType), gameType); Trial dataMiniGameTrial = currentPlayer.masterTrialsList[currentPlayer.currentTrialForEdit]; if (pendingMiniGameType != parsed_enum) // if the values are different: { pendingMiniGameType = parsed_enum; valuesChanged = true; //pendingMiniGameManager.SetMiniGameType(pendingMiniGameManager.gameType); pendingMiniGameSettings = new MiniGameCritterWalkBasicSettings(); if (trainerModuleScript.gameController.masterTrainer.loadedTrainingSave != null) { pendingMiniGameSettings.CopySettingsFromLoad(trainerModuleScript.gameController.masterTrainer.loadedTrainingSave.savedMiniGameSettings); } pendingMiniGameSettings.InitGameOptionsList(); // Inputs / Outputs button toggles //InitializePanelInputList(); //InitializePanelOutputList(); InitializePanelOptionsList(); //DebugBot.DebugFunctionCall("TMiniGameUI; VALUES CHANGED", debugFunctionCalls); } //DebugBot.DebugFunctionCall("TMiniGameUI; ChooseMiniGame(" + pendingMiniGameManager.gameType.ToString() + "); " + pendingMiniGameManager.gameType.ToString(), debugFunctionCalls); } UpdateUIWithCurrentData(); }
public void ChooseMiniGame(string gameType) { // clicked on a drop-down sub-button: DebugBot.DebugFunctionCall("TMiniGameUI; ChooseMiniGame(" + gameType + "); ", debugFunctionCalls); Player currentPlayer = trainerModuleScript.gameController.masterTrainer.PlayerList[trainerModuleScript.gameController.masterTrainer.CurPlayer-1]; if(currentPlayer.masterTrialsList.Count-1 < currentPlayer.currentTrialForEdit) { // if trialsList doesn't have an entry for current Index DebugBot.DebugFunctionCall("TMiniGameUI; Index out of RANGE!; ", debugFunctionCalls); } else { // TrialsList has a valid entry: MiniGameManager.MiniGameType parsed_enum = (MiniGameManager.MiniGameType)System.Enum.Parse( typeof( MiniGameManager.MiniGameType ), gameType ); Trial dataMiniGameTrial = currentPlayer.masterTrialsList[currentPlayer.currentTrialForEdit]; if(pendingMiniGameType != parsed_enum) { // if the values are different: pendingMiniGameType = parsed_enum; valuesChanged = true; //pendingMiniGameManager.SetMiniGameType(pendingMiniGameManager.gameType); pendingMiniGameSettings = new MiniGameCritterWalkBasicSettings(); if (trainerModuleScript.gameController.masterTrainer.loadedTrainingSave != null) { pendingMiniGameSettings.CopySettingsFromLoad(trainerModuleScript.gameController.masterTrainer.loadedTrainingSave.savedMiniGameSettings); } pendingMiniGameSettings.InitGameOptionsList(); // Inputs / Outputs button toggles //InitializePanelInputList(); //InitializePanelOutputList(); InitializePanelOptionsList(); //DebugBot.DebugFunctionCall("TMiniGameUI; VALUES CHANGED", debugFunctionCalls); } //DebugBot.DebugFunctionCall("TMiniGameUI; ChooseMiniGame(" + pendingMiniGameManager.gameType.ToString() + "); " + pendingMiniGameManager.gameType.ToString(), debugFunctionCalls); } UpdateUIWithCurrentData(); }
public void SetMiniGameType(MiniGameManager.MiniGameType newGameType, MiniGameSettingsBase gameSettings) // Change game type and re-instantiate miniGameInstance { DebugBot.DebugFunctionCall("Trial; SetMiniGameType(); " + gameType.ToString(), debugFunctionCalls); miniGameInstance = null; gameType = newGameType; // Update GameType to new Type! // CREATE mini-game instance! !!!!!!!!!!!!! Come back to this for Improvement Later!!!!!!! if (newGameType == MiniGameType.None) { miniGameInstance = new MiniGameBase(); //miniGameInstance = newGameInstance as MiniGame; } /*else if(newGameType == MiniGameType.MoveToTarget3D) { * MiniGameMoveToTarget3D newGameInstance = new MiniGameMoveToTarget3D(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.CreatureSwimBasic) { * // SHOULD the input/output Lists depend on the Agent's full Genome, or should the minigame have control over hookups? * // ... Maybe eventually the Agent's genome should dictate, but for now, to avoid a complete re-write, will leave the ability * // ... of miniGame's to choose which input/output neurons to hook up. Save that change for the big NEAT update where creature * // ... topologies can morph and differ within a population. * Debug.Log("BROKEN!! MiniGameManager public void SetMiniGameType(MiniGameManager.MiniGameType newGameType)"); * CritterGenome templateBody = playerRef.masterPopulation.templateGenome; * //MiniGameCreatureSwimBasic newGameInstance = new MiniGameCreatureSwimBasic(templateBody); * //miniGameInstance = newGameInstance; * }*/ else if (newGameType == MiniGameType.CritterWalkBasic) { CritterGenome templateBody = playerRef.masterPopulation.templateGenome; //Debug.Log("playerRef.masterPopulation.templateBodyGenome: " + playerRef.masterPopulation.templateBodyGenome.creatureBodySegmentGenomeList[0].addOn1.ToString()); //Debug.Log("templateBody: " + templateBody.creatureBodySegmentGenomeList[0].addOn1.ToString()); MiniGameCritterWalkBasic newGameInstance = new MiniGameCritterWalkBasic(templateBody); newGameInstance.UseSettings((MiniGameCritterWalkBasicSettings)gameSettings); newGameInstance.InitializeGame(); miniGameInstance = newGameInstance; Debug.Log("miniGameInstance.inputChannelsList.Count: " + miniGameInstance.inputChannelsList.Count.ToString() + "miniGameInstance.outputChannelsList.Count: " + miniGameInstance.outputChannelsList.Count.ToString()); } /*else if(newGameType == MiniGameType.RobotArmSimple) { * MiniGameRobotArm newGameInstance = new MiniGameRobotArm(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.PhysXWorm) { * MiniGamePhysXWorm newGameInstance = new MiniGamePhysXWorm(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.BallCatch) { * MiniGameBallCatch newGameInstance = new MiniGameBallCatch(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.ObstacleNavigation) { * MiniGameObstacleNavigation newGameInstance = new MiniGameObstacleNavigation(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.PoleBalancing2D) { * MiniGamePoleBalancing2D newGameInstance = new MiniGamePoleBalancing2D(); * miniGameInstance = newGameInstance; * } * else if(newGameType == MiniGameType.SpaceshipShooter) { * MiniGameSpaceshipShooter newGameInstance = new MiniGameSpaceshipShooter(); * miniGameInstance = newGameInstance; * }*/ SetInputOutputArrays(); // Haven't set input/output lists for the minigame yet.... }