IEnumerator LoadLevel() { HandleSelectedOption(); yield return(new WaitForSeconds(0.6f)); MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "select"); }
IEnumerator LoadLevel() { //проверяем, является ли игрок компьютером for (int i = 0; i < charManager.players.Count; i++) { if (charManager.players[i].playerType == PlayerBase.PlayerType.ai) { if (charManager.players[i].playerPrefab == null) { int ranValue = Random.Range(0, potraitList.Count); charManager.players[i].playerPrefab = charManager.returnCharacterWithID(potraitList[ranValue].characterId).prefab; Debug.Log(potraitList[ranValue].characterId); } } } yield return(new WaitForSeconds(2)); if (charManager.solo) { MySceneManager.GetInstance().CreateProgression(); MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "level_1"); } }
IEnumerator LoadLevel() { //if any of the players is an AI, then assign a random character to the prefab for (int i = 0; i < charManager.players.Count; i++) { if (charManager.players[i].playerType == PlayerBase.PlayerType.ai) { if (charManager.players[i].playerPrefab == null) { int ranValue = Random.Range(0, potraitList.Count); charManager.players[i].playerPrefab = charManager.returnCharacterWithID(potraitList[ranValue].characterId).prefab; Debug.Log(potraitList[ranValue].characterId); } } } yield return(new WaitForSeconds(2));//after 2 seconds load the level if (charManager.solo) { MySceneManager.GetInstance().CreateProgression(); MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "level_1"); } }
IEnumerator LoadLevel() { //Se um dos jogadores for AI, entao escolhe qualquer personagem do prefab for (int i = 0; i < charManager.players.Count; i++) { if (charManager.players[i].playerType == PlayerBase.PlayerType.ai) { if (charManager.players[i].playerPrefab == null) { int ranValue = Random.Range(0, potraitPrefabs.Length); charManager.players[i].playerPrefab = charManager.returnCharacterWithID(potraitPrefabs[ranValue].characterId).prefab; Debug.Log(potraitPrefabs[ranValue].characterId); } } } yield return(new WaitForSeconds(2));// depois de dois segundos vai carregar o level if (charManager.solo) { MySceneManager.GetInstance().CreateProgression(); MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "level_1"); } }
//初始化游戏基础 static public void InitGameBase() { //设置Log Application.logMessageReceived += OnLog; Application.logMessageReceivedThreaded += OnLog; //初始化游戏引擎的一些设置 GameSettings.OnInit(); // MVC GameFacade.GetInstance().OnInit(); // 场景管理 mSceneManager = MySceneManager.GetInstance(); mSceneManager.OnInit(); //添加全局FPS组件 Main.Instance.AddMainComponent <ShowFPS>(); //添加全局InGameLog组件 Main.Instance.AddMainComponent <InGameLog>(); // 对象池管理 GameObject poolRoot = new GameObject("GameObjectPool"); poolRoot.transform.SetParent(Main.Instance.transform); GameObjectPool.GetInstance().root = poolRoot; //Network NetManager.GetInstance().OnInit(); //Add temp entrance. Main.Instance.AddMainComponent <TempEntrance>(); initState = GameInitState.GameBaseInited; }
IEnumerator LoadLevel() { audioManager.soundPlay("Effect_Win"); // AI get random character prefab for (int i = 0; i < charManager.players.Count; i++) { if (charManager.players[i].playerType == PlayerBase.PlayerType.ai) { if (charManager.players[i].playerPrefab == null) { int ranValue = Random.Range(0, potraitPrefabs.Length); charManager.players[i].playerPrefab = charManager.returnCharacterWithId(potraitPrefabs[ranValue].characterId).prefab; } } } yield return(new WaitForSeconds(2)); // system to randomise between level 1 and 2 for fight level. i = Random.Range(0, 2); if (i == 1) { MySceneManager.GetInstance().RequestLevelOnLoad(MySceneManager.SceneType.prog, "level_1"); } else { MySceneManager.GetInstance().RequestLevelOnLoad(MySceneManager.SceneType.prog, "level_2"); } }
IEnumerator LoadLevelPrev() { yield return(new WaitForSeconds(0.6f)); string nextScene = MySceneManager.GetInstance().mainScenes[1].levelId; MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, nextScene); }
IEnumerator LoadLevel() { HandleSelectedOption(); yield return(new WaitForSeconds(0.6f)); string nextScene = MySceneManager.GetInstance().mainScenes[2].levelId; MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, nextScene); }
private void Start() { charManager = CharacterManager.GetInstance(); numberOfPlayers = charManager.numberOfUsers; sceneManager = MySceneManager.GetInstance(); charManager.solo = (numberOfPlayers == 1); }
public void RequestAISnapshot(AICharacter t) { int index = MySceneManager.GetInstance().progIndex; if (index > ai_stats.Count - 1) { index = ai_stats.Count - 1; } SetAIStats(index, t); }
public void WinState() { if (charManager.solo) { sceneManager.progressionBase++; } if (sceneManager.progressionBase == 2 && charManager.solo) { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "GameOver"); } }
void Start() { //get the references from the singletons charM = CharacterManager.GetInstance(); levelUI = LevelUI.GetInstance(); camM = GameObject.Find("CameraRig").GetComponent <CameraControl>(); sceneManager = MySceneManager.GetInstance(); vPlayer = null; //init the WaitForSeconds oneSec = new WaitForSeconds(1); //levelUI.AnnouncerTextLine1.gameObject.SetActive(false); //levelUI.AnnouncerTextLine2.gameObject.SetActive(false); //Turn off AI and Player Controls controlEnabled = false; StartCoroutine("StartGame"); }
IEnumerator LoadScene() { yield return(new WaitForSeconds(timer)); MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "intro"); }
/// <summary> ///Loads the main menu scene. /// </summary> public void returnToMenu() { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "TitleMenu"); Time.timeScale = timeScale; }
public void EnterGame(object para) { UIManager.GetInstance().CloseUI("Login"); MySceneManager.GetInstance().SwitchToScene(SceneId.Castle); }
IEnumerator LoadLevel() { //if any of the players is an AI, then assign a random character to the prefab for (int i = 0; i < charManager.players.Count; i++) { if (charManager.players[i].playerType == PlayerBase.PlayerType.ai) { if (charManager.players[i].playerPrefab == null) { int ranValue = Random.Range(0, potraitList.Count); charManager.players[i].playerPrefab = charManager.returnCharacterWithID(potraitList[ranValue].characterId).prefab; charManager.players[i].playerPrefab.GetComponent <TopmanPlayerController>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanBarrier>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanDive>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanRush>().enabled = false; charManager.players[i].playerPrefab.GetComponent <AIManager>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIBarrier>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIDive>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIRush>().enabled = true; Debug.Log(potraitList[ranValue].characterId); } else { charManager.players[i].playerPrefab.GetComponent <TopmanPlayerController>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanBarrier>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanDive>().enabled = false; charManager.players[i].playerPrefab.GetComponent <TopmanRush>().enabled = false; charManager.players[i].playerPrefab.GetComponent <AIManager>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIBarrier>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIDive>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIRush>().enabled = true; } } else { charManager.players[i].playerPrefab.GetComponent <TopmanPlayerController>().enabled = true; charManager.players[i].playerPrefab.GetComponent <TopmanBarrier>().enabled = true; charManager.players[i].playerPrefab.GetComponent <TopmanDive>().enabled = true; charManager.players[i].playerPrefab.GetComponent <TopmanRush>().enabled = true; charManager.players[i].playerPrefab.GetComponent <AIManager>().enabled = false; charManager.players[i].playerPrefab.GetComponent <AIBarrier>().enabled = false; charManager.players[i].playerPrefab.GetComponent <AIDive>().enabled = false; charManager.players[i].playerPrefab.GetComponent <AIRush>().enabled = false; } } yield return(new WaitForSeconds(2));//after 2 seconds load the level if (charManager.solo) { if (progressionMade == true && stepsToWin >= 1) { stepsToWin = 0; MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "WinScreen"); } if (progressionMade == false && stepsToWin < 1) { MySceneManager.GetInstance().CreateProgression(); MySceneManager.GetInstance().LoadNextOnProgression(); progressionMade = true; Debug.Log("ProgressionMade"); } else if (progressionMade == true) { MySceneManager.GetInstance().LoadNextOnProgression(); } } else { if (stageSelected == false) { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "Loading"); stageSelected = true; } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "WinScreen"); } } }
public void ReceiveFightMsg(object para) { SetFightInfo((GC_FIGHT)para); MySceneManager.GetInstance().SwitchToScene(SceneId.BattleTest); }
IEnumerator EndTurn() { //Espere 3 segundos pra limpar o text yield return(oneSec); yield return(oneSec); yield return(oneSec); //Encontre o player que ganhou PlayerBase vPlayer = FindWinningPlayer(); if (vPlayer == null)// Se a nossa funcao retornar null { levelUI.AnnouncerTextLine1.text = "Empate!"; levelUI.AnnouncerTextLine1.color = Color.blue; } else { //Se nao aquele jogador ganhou levelUI.AnnouncerTextLine1.text = vPlayer.playerId + " Ganhou!!"; levelUI.AnnouncerTextLine1.color = Color.red; } yield return(oneSec); yield return(oneSec); yield return(oneSec); //Checa se o vencedor teve algum dano if (vPlayer != null) { //Se nao, entao ganhou um do caralho if (vPlayer.playerStates.health == 100) { levelUI.AnnouncerTextLine2.gameObject.SetActive(true); levelUI.AnnouncerTextLine2.text = "GG IZI DEMAIS BRO"; } } yield return(oneSec); yield return(oneSec); yield return(oneSec); currentTurn++; bool matchOver = isMatchOver(); if (!matchOver) { StartCoroutine("InitTurn"); } else { for (int i = 0; i < charM.players.Count; i++) { charM.players[i].score = 0; charM.players[i].hasCharacter = false; } if (charM.solo) { if (vPlayer == charM.players[0]) { MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "game_over"); } } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "intro"); } } }
public void BackButton() { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "TitleMenu"); }
public void StartBattle() { MySceneManager.GetInstance().SwitchToScene(SceneId.BattleTest); }
IEnumerator EndTurn() { //wait 3 seconds for the previous text to clearly show yield return(oneSec); yield return(oneSec); yield return(oneSec); //find who was the player that won PlayerBase vPlayer = FindWinningPlayer(); if (vPlayer == null) //if our function returned a null { //that means it's a draw levelUI.AnnouncerTextLine1.text = "Draw"; levelUI.AnnouncerTextLine1.color = Color.blue; } else { //else that player is the winner levelUI.AnnouncerTextLine1.text = vPlayer.playerId + " Wins!"; levelUI.AnnouncerTextLine1.color = Color.red; } //wait 3 more seconds yield return(oneSec); yield return(oneSec); yield return(oneSec); //check to see if the victorious player has taken any damage if (vPlayer != null) { //if not, then it's a flawless victory if (vPlayer.playerStates.health == 100) { levelUI.AnnouncerTextLine2.gameObject.SetActive(true); levelUI.AnnouncerTextLine2.text = "Flawless Victory!"; } } //wait 3 seconds yield return(oneSec); yield return(oneSec); yield return(oneSec); currentTurn++;//add to the turn counter bool matchOver = isMatchOver(); if (!matchOver) { StartCoroutine("InitTurn"); // and start the loop for the next turn again } else { for (int i = 0; i < charM.players.Count; i++) { charM.players[i].score = 0; charM.players[i].hasCharacter = false; } if (charM.solo) { if (vPlayer == charM.players[0]) { MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "game_over"); } } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "select"); } } }
IEnumerator EndTurn() { yield return(Secs); yield return(Secs); yield return(Secs); PlayerBase vPlayer = FindWinningPlayer(); if (vPlayer == null) { levelUI.Line1.text = "Draw"; levelUI.Line1.color = Color.blue; } else { levelUI.Line1.text = vPlayer.playerId + " Wins!"; levelUI.Line1.color = Color.red; } yield return(Secs); yield return(Secs); yield return(Secs); if (vPlayer != null) { if (vPlayer.playerStates.health == 100) { levelUI.Line2.gameObject.SetActive(true); levelUI.Line2.text = "Flawless Victory!"; } } yield return(Secs); yield return(Secs); yield return(Secs); turn1++; bool matchOver = isMatchOver(); if (!matchOver) { StartCoroutine("InitTurn"); } else { for (int i = 0; i < Playerr.players.Count; i++) { Playerr.players[i].score = 0; Playerr.players[i].hasCharacter = false; } if (Playerr.solo) { if (vPlayer == Playerr.players[0]) { MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "game_over"); } } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "select"); } } }
IEnumerator EndTurn() { yield return(oneSec); yield return(oneSec); yield return(oneSec); //кто победитель? PlayerBase vPlayer = FindWinningPlayer(); if (vPlayer == null) //если функция вернула null, значит ничья { levelUI.AnnouncerTextLine1.text = "Draw"; levelUI.AnnouncerTextLine1.color = Color.blue; } else { //однако если победитель-игрок есть, то... levelUI.AnnouncerTextLine1.text = vPlayer.playerId + " Wins!"; levelUI.AnnouncerTextLine1.color = Color.red; } yield return(oneSec); yield return(oneSec); yield return(oneSec); //проверяем получил ли игрок урон вообще if (vPlayer != null) { //если нет, то это безукоризненная победа if (vPlayer.playerStates.health == 100) { levelUI.AnnouncerTextLine2.gameObject.SetActive(true); levelUI.AnnouncerTextLine2.text = "Flawless Victory!"; } } yield return(oneSec); yield return(oneSec); yield return(oneSec); currentTurn++;//считаем раунд bool matchOver = isMatchOver(); if (!matchOver) { StartCoroutine("InitTurn"); } else { for (int i = 0; i < charM.players.Count; i++) { charM.players[i].score = 0; charM.players[i].hasCharacter = false; } if (charM.solo) { if (vPlayer == charM.players[0]) { MySceneManager.GetInstance().LoadNextOnProgression(); } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "game_over"); } } else { MySceneManager.GetInstance().RequestLevelLoad(SceneType.main, "select"); } } }
public void SwitchToMapScene() { MySceneManager.GetInstance().SwitchToScene(SceneId.Map); }
public void SwitchToCastle() { MySceneManager.GetInstance().SwitchToScene(SceneId.Loading, SceneId.Castle); }
IEnumerator EndTurn() { // run end turn Ienumerator to begin the clean up cycle of a turn, disvoering which round it is, who won and what to do next. yield return(oneSec); yield return(oneSec); yield return(oneSec); PlayerBase vPlayer = FindWinningPlayer(); if (vPlayer == null) { levelUi.AnnouncerTextLine1.text = "Draw"; levelUi.AnnouncerTextLine1.color = Color.blue; } else { levelUi.AnnouncerTextLine1.text = vPlayer.playerId + " Wins!"; levelUi.AnnouncerTextLine1.color = Color.red; } yield return(oneSec); yield return(oneSec); yield return(oneSec); if (vPlayer != null) { if (vPlayer.playerStates.health == 100) { levelUi.AnnouncerTextLine2.gameObject.SetActive(true); levelUi.AnnouncerTextLine2.text = "Flawless Victory!"; } } yield return(oneSec); yield return(oneSec); yield return(oneSec); currentTurn++; bool matchOver = isMatchOver(); if (!matchOver) { StartCoroutine(InitTurn()); } else { for (int i = 0; i < charM.players.Count; i++) { charM.players[i].score = 0; charM.players[i].hasCharacter = false; } // returns use to a scene depending on 1 player or 2 and won. If 2 player, returns to intro scene and resents character managers. if (charM.solo) { if (vPlayer == charM.players[0]) { MySceneManager.GetInstance().RequestLevelOnLoad(MySceneManager.SceneType.main, "winGame"); } else { MySceneManager.GetInstance().RequestLevelOnLoad(MySceneManager.SceneType.main, "gameOver"); } } else { MySceneManager.GetInstance().RequestLevelOnLoad(MySceneManager.SceneType.main, "winGame"); if (vPlayer == charM.players[0]) { winner = 0; } else { winner = 1; } charM.players[1].playerType = PlayerBase.PlayerType.ai; charM.players[1].playerPrefab = null; charM.players[1].playerStates = null; charM.players[0].playerPrefab = null; charM.players[0].playerStates = null; } } }
public void StageOneStart() { MySceneManager.GetInstance().RequestLevelLoad(SceneType.prog, "Stage 1"); }
public void SwitchToEditScene() { MySceneManager.GetInstance().SwitchToScene(SceneId.MapEditor); }
public void StartLua() { MySceneManager.GetInstance().SwitchToScene(SceneId.LuaTest); }