// Use this for initialization void Start() { SoundSystem.Instance.PlayClip(AUDIO_TYPE.BACKGROUND_MUSIC, AudioClipManager.GetInstance().GetAudioClip("GameSceneBGM"), true, "BGMSource"); _gameCondition = GAME_CONDITION.SELECT; _player1 = _player1Object.AddComponent <ManualPlayer>(); _player2 = _player2Object.AddComponent <AI>(); _player1.Initialize(1); _player2.Initialize(2); _currentPlayer = _player1; _currentPlayer.GetCharController().IsPlaying(true); _boardController.AddObstacle(1, 1, true); _boardController.AddObstacle(3, 3, true); _endScreen = GameObject.Find("EndScreenDisplay").GetComponent <GameEndDisplayScript>(); _isStop = false; }
public IEnumerator BattleFlow(IPlayer challenger, IPlayer defender, BoardController board) { _isBattle = BATTLE_STATE.Play; ICharacter challengerChar = challenger.GetCharController().GetCurrentCharacter(); if (challengerChar.GetMyState() == ICharacter.STATE.GREEN) { _isBattle = BATTLE_STATE.Finished; yield break; } List <ICharacter> defList = new List <ICharacter>(); foreach (ICharacter character in defender.GetCharController().GetCharacters()) { if (character.GetMyState() == ICharacter.STATE.FROZEN) { continue; } if (GetDistance(challengerChar, character) > challengerChar.GetAttackRange()) { continue; } if (challengerChar.GetMyType() == character.GetMyType()) { continue; } defList.Add(character); } if (defList.Count == 0) { _isBattle = BATTLE_STATE.Finished; yield break; } // 戦闘アニメーションを再生する foreach (ICharacter character in defList) { character.AttackAnimation(true); } challengerChar.AttackAnimation(true); // カットイン挿入 challenger.GetCharController().PlayCutIn(challengerChar); switch (challengerChar.GetMyType()) { case ICharacter.TYPE.FIGHTER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("WarriorAtk_Voice_1"), false, "GenericGameSFX"); break; case ICharacter.TYPE.ARCHER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("ArcherAtk_Voice_1"), false, "GenericGameSFX"); break; case ICharacter.TYPE.MAGICIAN: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("Mage_Voice_1"), false, "GenericGameSFX"); break; } yield return(new WaitForSeconds(3.0f)); // 戦闘アニメーションを終了する foreach (ICharacter character in defList) { character.AttackAnimation(false); } challengerChar.AttackAnimation(false); // 戦わせる bool isChallengerDeath = false; for (int i = defList.Count - 1; i >= 0; --i) { if (CheckCompatibility(challengerChar.GetMyType(), defList[i].GetMyType()) == Compatibility.Strong) { challenger.GetCharController().CharaVictory(challengerChar); challengerChar.AttackEffect(defList[i].transform.position); if (defList[i].GetMyState() == ICharacter.STATE.GREEN) { continue; } defList[i].DeathAnimation(); defList[i].ChangeState(ICharacter.STATE.FROZEN); } else { if (defList[i].GetMyState() == ICharacter.STATE.GREEN) { continue; } defender.GetCharController().CharaVictory(defList[i]); challengerChar.DeathAnimation(); defList[i].AttackEffect(challengerChar.transform.position); challengerChar.ChangeState(ICharacter.STATE.FROZEN); isChallengerDeath = true; } } yield return(new WaitForSeconds(1.0f)); for (int i = defList.Count - 1; i >= 0; --i) { if (defList[i].GetMyState() == ICharacter.STATE.FROZEN) { board.AddObstacle(defList[i].X(), defList[i].Y()); defender.GetCharController().CharaLose(defList[i]); switch (defList[i].GetMyType()) { case ICharacter.TYPE.FIGHTER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("WarriorDmg_Voice_1"), false, "GenericGameSFX"); break; case ICharacter.TYPE.ARCHER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("ArcherDmg_Voice_1"), false, "GenericGameSFX"); break; case ICharacter.TYPE.MAGICIAN: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("MageDmg_Voice_1"), false, "GenericGameSFX"); break; } } } if (isChallengerDeath) { board.AddObstacle(challengerChar.X(), challengerChar.Y()); challenger.GetCharController().CharaLose(challengerChar); switch (challengerChar.GetMyType()) { case ICharacter.TYPE.FIGHTER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("WarriorDmg_Voice_2"), false, "GenericGameSFX"); break; case ICharacter.TYPE.ARCHER: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("ArcherDmg_Voice_2"), false, "GenericGameSFX"); break; case ICharacter.TYPE.MAGICIAN: SoundSystem.Instance.PlayClip(AUDIO_TYPE.SOUND_EFFECTS, AudioClipManager.GetInstance().GetAudioClip("MageDmg_Voice_2"), false, "GenericGameSFX"); break; } } // 戦後アニメーション _isBattle = BATTLE_STATE.Finished; }