//敵のターン開始 public void FightEnemy() { //死んでるか if (dead) { Unit.TurnEnemy(false); return; } //移動の必要性 if (enemyVerstion == 4 && bossMove == 0) { int other = 0; for (int i = 0; i < 5; i++) { if (Unit.DeadEnemy(i)) { other++; } } if (other > 3) { bossMove++; FightEnemy(); return; } if (Unit.playerPosition.x > 5 && Unit.playerPosition.x < 9 && Unit.playerPosition.y > 0 && Unit.playerPosition.y < 7) { AttackEnemy(); return; } bossMove++; } float dis = enemyVerstion == 4 ? 2f : 1f; if (Vector2.Distance(Unit.GetEnemyGamePosition(enemyID), Unit.playerPosition) > dis) { TurnAndPhase.SetEnemyCommand(TurnAndPhase.Type.Move); Floor.ShowSelecting(Unit.GetEnemyGamePosition(enemyID), Unit.enemyParameterList[enemyID][(int)Unit.StatusName.DIS]); root.Clear(); Floor.NearPlayer(ref root); Unit.ChangePosition(enemyID, root[0]); moveCounter = 0; rootCounter = root.Count; FollowRoot(root[rootCounter - 1]); action = (int)Action.Move; animator.SetBool("EnemyMove", true); Music.PlaySELoop(Music.Clip.Walk); } else { AttackEnemy(); } }
//攻撃開始 public void AttackEnemy() { //攻撃範囲内にいるか float dis = enemyVerstion == 4 ? 2f : 1f; if (Vector2.Distance(Unit.GetEnemyGamePosition(enemyID), Unit.playerPosition) <= dis) { TurnAndPhase.SetEnemyCommand(TurnAndPhase.Type.None); if (enemyVerstion == 4) { Floor.ShowBossEnemyATK(Unit.GetEnemyGamePosition(enemyID), (int)dis); } else { Floor.ShowSelecting(Unit.GetEnemyGamePosition(enemyID), (int)dis); } action = (int)Action.Attack; Log.ShowLog(3); timer = 0; FollowRoot(Unit.playerPosition); Unit.ChangeDirectionPlayer(enemyID); animator.SetTrigger("AttackTrigger"); swingFlag = true; } else { if (enemyVerstion == 4 && doubleAttack == 0) { doubleAttack++; FightEnemy(); return; } doubleAttack--; Unit.TurnEnemy(false); } }