private void Update() { if (scontinue.isActive() == true) { return; } if (manager.GetKeyDown(GameManager.e_input.PAUSE) && (manager.gameManagerState == GameManager.EGameState.GameRunning)) { if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Main_Menu_UI_Validate"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Main_Menu_UI_Validate", music); #endif } manager.OnGamePaused(); igmenu.SetActive(true); messageStage = GameObject.Find("StageMessageText(Clone)"); if (messageStage != null) { messageStage.SetActive(false); } return; } if (manager.gameManagerState != GameManager.EGameState.GamePaused) { return; } float translation = Input.GetAxisRaw("Vertical"); if ((isMoving == true) && (Mathf.Round(translation) == 0)) { isMoving = false; } if (manager.GetKeyDown(GameManager.e_input.CANCEL) || manager.GetKeyDown(GameManager.e_input.PAUSE)) { if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Main_Menu_UI_Back"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Main_Menu_UI_Back", music); #endif } igmenu.SetActive(false); if (messageStage != null) { messageStage.SetActive(true); } manager.OnGameResumed(); } if (manager.GetKeyDown(GameManager.e_input.DOWN, -0.7f) && ((actual_button + 1) < buttons.Length)) { ChangeButton(1); } else if (manager.GetKeyDown(GameManager.e_input.DOWN, -0.7f) && (actual_button == (buttons.Length - 1))) { ChangeButton(-(buttons.Length - 1)); } else if (manager.GetKeyDown(GameManager.e_input.UP, 0.7f) && ((actual_button - 1) >= 0)) { ChangeButton(-1); } else if (manager.GetKeyDown(GameManager.e_input.UP, 0.7f) && (actual_button == 0)) { ChangeButton(buttons.Length - 1); } if (manager.GetKeyDown(GameManager.e_input.ACCEPT)) { if (actual_button == 0) { if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Main_Menu_UI_Validate"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Main_Menu_UI_Validate", music); #endif } igmenu.SetActive(false); if (messageStage != null) { messageStage.SetActive(true); } manager.OnGameResumed(); } else if (actual_button == 1) { if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Friture_Stop"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Friture_Stop", music); #endif } StartCoroutine(LoadYourAsyncScene("Menu/MainMenu")); manager.OnGameResumed(); if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Music_Menu_Stop"); MusicManager.PostEvent("Music_Stop"); MusicManager.PostEvent("Music_Menu_Play"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Music_Menu_Stop", music); AkSoundEngine.PostEvent("Music_Stop", music); AkSoundEngine.PostEvent("Music_Menu_Play", music); #endif } } } }
/** * Updates the player states */ void FixedUpdate() { if ((isContinue == true) && (scontinue.isActive() == false)) { OnGameResumed(); isDead = false; isContinue = false; } if (paused) { return; } Vector2 axis = inputController.GetAxis(); body2D.AddForce(new Vector2(speed.x * axis.x, speed.y * axis.y)); // Animator hooks :) if (axis.x > 0) { Panimator.Right(); } else if (axis.x < 0) { Panimator.Left(); } // if (axis.x == 0.0f && axis.y == 0.0f) { if (!slide) { body2D.velocity = new Vector2(0.0f, 0.0f); } if (!playerJustStoppedToMove) { OnPlayerJustStoppedToMove(); playerJustStoppedToMove = true; playerJustStartedToMove = false; } } else { if (!playerJustStartedToMove) { OnPlayerJustStartedToMove(); playerJustStartedToMove = true; playerJustStoppedToMove = false; } } if (inputController.IsAddingSphere()) { sphereController.AddSphere(); } else if (inputController.IsRemovingSphere()) { sphereController.RemoveSphere(); } bool bIncreaseRadius = false; if (inputController.IsClockwiseRotation()) { bIncreaseRadius = true; sphereController.ReverseClockwise(); } else if (inputController.IsCounterClockwiseRotation()) { bIncreaseRadius = true; sphereController.ReverseCounterClockwise(); } if (bIncreaseRadius) { sphereController.IncreaseRadius(); } else { sphereController.DecreaseRadius(); } // Player life hook switch (hitPoint) { case 0: playerStateRenderer.sprite = playerStateSprites[0]; Panimator.SetLife(0); break; case 1: playerStateRenderer.sprite = playerStateSprites[1]; Panimator.SetLife(1); break; case 2: playerStateRenderer.sprite = playerStateSprites[2]; Panimator.SetLife(2); break; case 3: playerStateRenderer.sprite = playerStateSprites[3]; Panimator.SetLife(3); break; case 4: playerStateRenderer.sprite = playerStateSprites[4]; Panimator.SetLife(4); break; case 5: playerStateRenderer.sprite = playerStateSprites[5]; Panimator.SetLife(5); break; case 6: playerStateRenderer.sprite = playerStateSprites[5]; Panimator.SetLife(6); break; default: break; } }