void checkInput() { if (Input.GetKeyDown(KeyCode.RightArrow) || (Input.GetAxis("Horizontal") >= 0.75f && !afterMove)) { previousMode = selectedMode; selectedMode = (selectedMode + 1) % modesLogo.Length; statSelectedMode = selectedMode; soundManager.effectSoundPlay(1); afterMove = true; } else if (Input.GetKeyDown(KeyCode.LeftArrow) || (Input.GetAxis("Horizontal") <= -0.75f && !afterMove)) { previousMode = selectedMode; selectedMode -= 1; if (selectedMode < 0) { selectedMode = modesLogo.Length - 1; } statSelectedMode = selectedMode; soundManager.effectSoundPlay(1); afterMove = true; } if (Input.GetAxis("Horizontal") == 0.0f) { afterMove = false; } if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown("joystick button 0")) { if (selectedMode != -1) { JumpToOtherScene.quickGoToScene("characterchoosen"); } } if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown("joystick button 1")) { JumpToOtherScene.quickGoToScene("mainmenu"); } }
void checkInput() { if (Input.GetKeyDown(KeyCode.RightArrow) || (Input.GetAxis("Horizontal") >= 0.75f && !afterMove)) { previousArena = selectedArena; if (selectedArena < arenasLogo.Length / maxRow) { selectedArena = (selectedArena + 1) % (arenasLogo.Length / maxRow); } else { selectedArena = (selectedArena + 1) % arenasLogo.Length; if (selectedArena == 0) { selectedArena = arenasLogo.Length / maxRow; } } statSelectedArena = selectedArena; arenaChoosenSFX(statSelectedArena); afterMove = true; } else if (Input.GetKeyDown(KeyCode.LeftArrow) || (Input.GetAxis("Horizontal") <= -0.75f && !afterMove)) { previousArena = selectedArena; selectedArena -= 1; if (selectedArena < 0) { selectedArena = (arenasLogo.Length / maxRow) - 1; } else if (selectedArena < arenasLogo.Length / maxRow && previousArena >= arenasLogo.Length / maxRow) { selectedArena = arenasLogo.Length - 1; } statSelectedArena = selectedArena; arenaChoosenSFX(statSelectedArena); afterMove = true; } else if (Input.GetKeyDown(KeyCode.UpArrow) || (Input.GetAxis("Vertical") >= 0.75f && !afterMove)) { previousArena = selectedArena; selectedArena = (selectedArena + (arenasLogo.Length / maxRow)) % arenasLogo.Length; statSelectedArena = selectedArena; arenaChoosenSFX(statSelectedArena); afterMove = true; } else if (Input.GetKeyDown(KeyCode.DownArrow) || (Input.GetAxis("Vertical") <= -1f) && !afterMove) { previousArena = selectedArena; selectedArena -= (arenasLogo.Length / maxRow); if (selectedArena < 0) { selectedArena = previousArena + (arenasLogo.Length / maxRow); } statSelectedArena = selectedArena; arenaChoosenSFX(statSelectedArena); afterMove = true; } if (Input.GetAxis("Horizontal") == 0.0f && Input.GetAxis("Vertical") == 0.0f) { afterMove = false; } if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown("joystick button 0")) { if (selectedArena != -1) { JumpToOtherScene.quickGoToScene("mainscene2"); } } if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown("joystick button 1")) { JumpToOtherScene.quickGoToScene("characterchoosen"); } }
void checkInput() { if (statSelectedCharacter2 == -1) { if (Input.GetKeyDown(KeyCode.RightArrow) || (Input.GetAxis("Horizontal") >= 0.75f && !afterMove)) { selectedCharacter = (selectedCharacter + 1) % charactersLogo.Length; if (selectedCharacter == statSelectedCharacter1) { selectedCharacter = (selectedCharacter + 1) % charactersLogo.Length; } soundManager.effectSoundPlay(1); afterMove = true; } else if (Input.GetKeyDown(KeyCode.LeftArrow) || (Input.GetAxis("Horizontal") <= -0.75f && !afterMove)) { selectedCharacter -= 1; if (selectedCharacter < 0) { selectedCharacter = charactersLogo.Length - 1; } if (selectedCharacter == statSelectedCharacter1) { selectedCharacter -= 1; if (selectedCharacter < 0) { selectedCharacter = charactersLogo.Length - 1; } } soundManager.effectSoundPlay(1); afterMove = true; } } if (Input.GetAxis("Horizontal") == 0.0f) { afterMove = false; } if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown("joystick button 0")) { if (statSelectedCharacter2 != -1) { JumpToOtherScene.quickGoToScene("arenachoosen"); } else { if (selectedCharacter != -1) { if (charactersLogo [selectedCharacter].GetComponent <CharacterLockSystem> ().getLockState() == CharacterLockSystem.LockState.unlocked) { if (statSelectedCharacter1 == -1) { statSelectedCharacter1 = selectedCharacter; selectedCharacter = -1; if (charactersLogo [statSelectedCharacter1].GetComponent <CharacterLockSystem> ().getCharacterName() == "erza") { soundManager.effectSoundPlay(3); } else if (charactersLogo [statSelectedCharacter1].GetComponent <CharacterLockSystem> ().getCharacterName() == "lyon") { soundManager.effectSoundPlay(4); } } else { if (statSelectedCharacter1 != selectedCharacter) //tidak memilih karakter yg sama { statSelectedCharacter2 = selectedCharacter; selectedCharacter = -1; } soundManager.effectSoundPlay(5); if (charactersLogo [statSelectedCharacter2].GetComponent <CharacterLockSystem> ().getCharacterName() == "erza") { StartCoroutine(playingDelaySFX(3)); } else if (charactersLogo [statSelectedCharacter2].GetComponent <CharacterLockSystem> ().getCharacterName() == "lyon") { StartCoroutine(playingDelaySFX(4)); } } } else { soundManager.effectSoundPlay(2); } } } } if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown("joystick button 1")) { if (statSelectedCharacter2 != -1) { statSelectedCharacter2 = -1; } else if (statSelectedCharacter1 != -1) { statSelectedCharacter1 = -1; } else { JumpToOtherScene.quickGoToScene("modechoosen"); } } }
void Update() { switch (state) { case BattleSceneState.characterInfo: //0 if (!alreadySummoned) { summonPlayerPrefab(CharacterChoosenManager.statSelectedCharacter1); summonEnemyPrefab(CharacterChoosenManager.statSelectedCharacter2); alreadySummoned = true; } break; case BattleSceneState.beginingPose: //1 if (!isAlreadyBeginingPose) { Player.Instance.CharaAnimator.SetBool("beginingPose", true); Enemy.Instance.CharaAnimator.SetBool("beginingPose", true); isAlreadyBeginingPose = true; } else { if (!Player.Instance.CharaAnimator.GetBool("beginingPose") && !Enemy.Instance.CharaAnimator.GetBool("beginingPose")) { state = BattleSceneState.battle; fightIcon.GetComponent <SpriteRenderer> ().enabled = true; } } break; case BattleSceneState.battle: //2 if (!isFightIconDestroyed) { if (fightIcon.transform.position.y < 1f) { fightIcon.transform.position = Vector3.MoveTowards(fightIcon.transform.position, new Vector3(0, 1f, 0), 0.3f); } else { Destroy(fightIcon); isFightIconDestroyed = true; } } break; case BattleSceneState.battlePause: //3 break; case BattleSceneState.winLosePose: //4 textWinLoseState.GetComponent <Text> ().enabled = true; if (WinLoseManager.Instance.isPlayer1Win()) { textWinLoseState.text = "Player 1 Win"; loadWinCharacterImage(CharacterChoosenManager.statSelectedCharacter1); winIdCharacter.text = "1"; Player.Instance.CharaAnimator.SetBool("winPose", true); } else if (WinLoseManager.Instance.isPlayer2Win()) { textWinLoseState.text = "Player 2 Win"; loadWinCharacterImage(CharacterChoosenManager.statSelectedCharacter2); winIdCharacter.text = "2"; Enemy.Instance.CharaAnimator.SetBool("winPose", true); } //WAKTU PEMANGGILAN MENGGUNAKAN DELAY StartCoroutine(WinLoseMenuDelayActivating()); break; case BattleSceneState.winLoseInfo: //5 textWinLoseState.enabled = false; winLoseMenu.SetActive(true); if (Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown("joystick button 12")) { PlayerPrefs.SetInt("playingTime", PlayerPrefs.GetInt("playingTime") + 1); if (useFSM) { StartCoroutine(hsController.savingFSMLogHistory()); } else { StartCoroutine(hsController.savingFuSMsLogHistory()); } /*StartCoroutine(hsController.connectFuSMsLogHistory()); * int playingTime = PlayerPrefs.GetInt("playingTime"); * int i = 0; * while (i < FuSMsLogHistory.Instance.getTransitionData().Count) * { * if (delaySaveLogTime < maxDelaySaveLogTime) * { * delaySaveLogTime += 1; * } * else * { * StartCoroutine(hsController.savingFuSMsLogHistory( * FuSMsLogHistory.Instance.getTransitionData()[i].transitionNumber, * playingTime, * FuSMsLogHistory.Instance.getTransitionData()[i].previousState, * FuSMsLogHistory.Instance.getTransitionData()[i].range, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackType.light, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackType.heavy, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackType.ranged, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackDirection.up, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackDirection.middle, * FuSMsLogHistory.Instance.getTransitionData()[i].totalAttackDirection.down, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.idle, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.walk, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.walkBackward, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.lightAttack, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.heavyAttack, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.rangedAttack, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.jump, * FuSMsLogHistory.Instance.getTransitionData()[i].nextStatePersentage.crouch, * FuSMsLogHistory.Instance.getTransitionData()[i].choosenStage)); * i = i + 1; * delaySaveLogTime = 0; * if(i%100 == 0) * { * maxDelaySaveLogTime = 60 * 6; * } * else * { * maxDelaySaveLogTime = 60; * } * // * } * }*/ } else if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown("joystick button 11")) { StopAllCoroutines(); JumpToOtherScene.quickGoToScene("modechoosen"); } break; } }