private void OnTriggerExit(Collider other) { if (other.tag == "minigame") { currentGame.endGame(); currentGame = null; } else if (other.tag == "roomChange" && gameManager.generateCeilings) { MazeRoom otherRoom = other.gameObject.GetComponentInParent <MazeCell>().room; if (otherRoom != currentRoom) { gameManager.activeRooms.Add(otherRoom); gameManager.activeRooms.Remove(currentRoom); if (!gameManager.activeRooms.Contains(currentRoom)) { currentRoom.ceiling.GetComponent <Ceiling>().fadeIn = true; currentRoom.ceiling.GetComponent <Ceiling>().fadeOut = false; otherRoom.ceiling.GetComponent <Ceiling>().fadeOut = true; otherRoom.ceiling.GetComponent <Ceiling>().fadeIn = false; } else { otherRoom.ceiling.GetComponent <Ceiling>().fadeOut = true; otherRoom.ceiling.GetComponent <Ceiling>().fadeIn = false; } currentRoom = otherRoom; } } }
void MinigameRandomizer() { int randomNumber; while (true) { randomNumber = Random.Range(0, miniGamesObject.Length - 1); bool minigameDone = false; foreach (minigame m in minigameDoneList) { if (m == (minigame)miniGamesObject[randomNumber]) { Debug.Log("zelfde"); minigameDone = true; } } if (!minigameDone) { Debug.Log("voegtoe"); currentMinigame = (minigame)miniGamesObject[randomNumber]; minigameDoneList.Add(currentMinigame); break; } if (minigameDoneList.Count - 1 == miniGamesObject.Length) { Debug.Log("count: " + minigameDoneList.Count + "lenght: " + miniGamesObject.Length); break; } } }
public void minigameStart(int whichGame) { Debug.Log(player.Incre.currentGame.ToString()); string sceneName = ""; minigame selectedGame = minigame.none; switch (whichGame) { case 1: sceneName = "Mode_Choose"; selectedGame = minigame.seeker; break; case 2: sceneName = "Mastermind_Menu"; selectedGame = minigame.mastermind; break; case 3: sceneName = "Conq"; selectedGame = minigame.conquer; break; case 4: sceneName = "Menu"; selectedGame = minigame.daredevil; break; case 5: sceneName = "MainMenu"; selectedGame = minigame.sokoban; break; } //if game is not on if (!player.Incre.gameON) { player.Incre.gameON = true; player.Incre.currentGame = selectedGame; Debug.Log(player.Incre.currentGame.ToString()); SceneManager.LoadScene(sceneName, LoadSceneMode.Single); } else if (player.Incre.gameON == true && player.Incre.currentGame != selectedGame) //game is on { nextScene = sceneName; player.Incre.nextGame = selectedGame; showMessage2("If you change the minigame, you will lose data. Continue to change the game?", "Warning!", dialogMode.changeGame); } else { nextScene = "ui"; player.Incre.nextGame = minigame.none; showMessage2("Do you want to close the minigame?", "Are you sure?", dialogMode.exitgame); } }
private void OnTriggerExit(Collider other) { if (other.tag == "Interactable") { touching = false; interactable = null; } if (other.tag == "minigame") { currntGame = null; } }
public void minigameStart(int whichGame) { Debug.Log(player.Incre.currentGame.ToString()); string sceneName = ""; minigame selectedGame = minigame.none; switch (whichGame) { //seeker case 1: sceneName = "Mode_Choose"; selectedGame = minigame.seeker; break; //mastermind case 2: sceneName = "Mastermind_Menu"; selectedGame = minigame.mastermind; break; //conquere case 3: sceneName = "Menu"; selectedGame = minigame.conquer; break; } //if game is not on if (player.Incre.gameON == false && player.Incre.timeleft.cur > 0) { player.Incre.gameON = true; player.Incre.currentGame = selectedGame; Debug.Log(player.Incre.currentGame.ToString()); SceneManager.LoadScene(sceneName, LoadSceneMode.Single); } else if (player.Incre.gameON == true && player.Incre.currentGame != selectedGame) //game is on { nextScene = sceneName; player.Incre.nextGame = selectedGame; showMessage2("If you change the minigame, you will lose the data. Continue to change the game?", "Warning!", dialogMode.changeGame); } else if (player.Incre.gameON == false && player.Incre.timeleft.cur <= 0) { showMessage("Not enough Time to play game", "You need to study to play more."); } else { nextScene = "ui"; player.Incre.nextGame = minigame.none; showMessage2("Do you want to close the minigame?", "Are you sure?", dialogMode.exitgame); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Interactable") { touching = true; interactable = other.gameObject; } if (other.tag == "minigame") { Debug.Log("enter game"); currntGame = other.gameObject.GetComponent <minigame>(); currntGame.startGame(); } }
/// <summary> /// balanced reward function. /// /// </summary> /// <param name="type">game type</param> /// <param name="usedStamina">used stamina to play one minigame</param> public static void getReward(minigame type, int usedStamina) { //invalid input if (usedStamina <= 0) { return; } //This part will be adjusted based on necessary playing time for each minigame double percentage = 0; //total 100 % double rewardRate = 2.5; switch (type) { case minigame.conquer: percentage = 20; break; case minigame.mastermind: percentage = 20; break; case minigame.seeker: percentage = 20; break; case minigame.daredevil: percentage = 20; break; case minigame.sokoban: percentage = 20; break; } percentage = percentage * 0.01; //reward coin double activeCoinReward = bal.getActiveCoinBonus() * usedStamina * percentage * rewardRate; double passiveCoinReward = bal.getPassiveCoinBonus() * usedStamina * percentage * rewardRate; player.Incre.coin.active += (int)activeCoinReward; player.Incre.coin.passive += (int)passiveCoinReward; //reward EXP double expReward = bal.getActiveEXPRate() * usedStamina * percentage * rewardRate; player.Incre.exp.cur += expReward; }
public static void sceneChange(minigame type, string newScene) { //unload if (activeGame == minigame.seeker) { SceneManager.UnloadScene(scene_seeker); scene_seeker = ""; } else if (activeGame == minigame.mastermind) { SceneManager.UnloadScene(scene_mastermind); scene_mastermind = ""; } else if (activeGame == minigame.conquer) { SceneManager.UnloadScene(scene_conquer); scene_conquer = ""; } //load if (type == minigame.seeker) { SceneManager.LoadScene(newScene, LoadSceneMode.Additive); scene_seeker = newScene; } else if (type == minigame.mastermind) { SceneManager.LoadScene(newScene, LoadSceneMode.Additive); scene_mastermind = newScene; } else if (type == minigame.conquer) { SceneManager.LoadScene(newScene, LoadSceneMode.Additive); scene_conquer = newScene; } else { Debug.Log("Please insert valid type"); } activeGame = type; }