public override void AIUpdate(EnemyCore enemy) { base.AIUpdate(enemy); var enemyPos = enemy.transform.position; if (!Target) { return; } enemy.Attack(); var targetPos = Target.transform.position; var dist = targetPos - enemyPos; var sqrLength = dist.sqrMagnitude; //移動先の設定 var attackRadius = enemy.AIParameter.MoveStartRadius; if (sqrLength > Mathf.Pow(attackRadius + enemy.AIParameter.MoveStartDifference, 2)) { enemy.Agent.destination = targetPos; } }
public override void AIUpdate(EnemyCore enemy) { base.AIUpdate(enemy); var enemyPos = enemy.transform.position; if (!Target) { return; } enemy.Attack(); var targetPos = Target.transform.position; var dist = targetPos - enemyPos; //向きの設定 SetRotarion(dist); }