protected override void AIUpdate_fly_detect() { base.AIUpdate_fly_detect(); float rand = GetAIRandomNumver(); switch (aiState) { case AISTATE.AISELECT: if (rand < AddAIProbNum(aiStateFly_flyEnd * ChengeModeRate)) { FlyMode_end(); } else if (rand < AddAIProbNum(aiStateFly_approch)) { SetAIState(AISTATE.APPROACH_DASH, 5.0f); } else if (rand < AddAIProbNum(aiStateFly_escape)) { SetAIState(AISTATE.ESCAPE_DASH, 3.0f); } else if (rand < AddAIProbNum(aiStateFly_attack)) { SetAIState(AISTATE.ATTACK, 20.0f); } break; case AISTATE.APPROACH_DASH: if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed)) { SetAIState(AISTATE.ATTACK, 20.0f); } break; case AISTATE.ESCAPE_DASH: if (nowTargetPos == null) { if (EnemyCtrl_fly.GetDistancePlayer_X() > 40.0f) { SetAIState(AISTATE.APPROACH_DASH, 5.0f); return; } EnemyCtrl_fly.SetDirectionToPl(); nowTargetPos = EnemyCtrl_fly.GetPostionFromPl_NearMe(40.0f); } if (EnemyCtrl_fly.MoveToTarget_X_reverse(1.0f, (Vector2)nowTargetPos, moveSpeed * 0.8f)) { nowTargetPos = null; SetAIState(AISTATE.ATTACK, 20.0f); } break; case AISTATE.WAIT: break; } }
protected override void AIUpdate_detect() { base.AIUpdate_detect(); float rand = GetAIRandomNumver(); switch (aiState) { case AISTATE.AISELECT: if (rand < AddAIProbNum(aiStateNum_fly * ChengeModeRate)) { FlyMode_start(); } else if (rand < AddAIProbNum(aiStateNum_walk)) { SetAIState(AISTATE.APPROACH_WALK, 4.0f); } else if (rand < AddAIProbNum(aiStateNum_dash)) { SetAIState(AISTATE.APPROACH_DASH, 4.0f); } else if (rand < AddAIProbNum(aiStateNum_attack)) { SetAIState(AISTATE.ATTACK, 20.0f); } else if (rand < 100) { SetAIState(AISTATE.WAIT, 4.0f); animator.SetTrigger("rest"); } break; case AISTATE.APPROACH_WALK: if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed * 0.5f)) { SetAIState(AISTATE.ATTACK, 20.0f); } break; case AISTATE.APPROACH_DASH: if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed)) { SetAIState(AISTATE.ATTACK, 20.0f); } break; case AISTATE.ATTACK: break; case AISTATE.WAIT: break; } }