//注視点を中心にカメラを円形に移動させる private void rotatePosition() { // 現在の位置が[0, aroundTime]の何分目の位置にいるか求める var rate = (aroundTime - (count % aroundTime)) / (float)aroundTime; // 求めたrate = [0, 1]をいるべき位置のラジアン[0, 2π]に変換する var radian = MyUtility.Interpolate(0f, 2f * Mathf.PI, rate); // 座標を更新する var currentPosition = transform.position; currentPosition = new Vector3(Mathf.Cos(radian) * distance, currentPosition.y, Mathf.Sin(radian) * distance); transform.position = currentPosition; }
// 敵の残り数から生成間隔を更新する private void updateCurrentIntervalTime() { var rate = (maxRemainedEnemy - currentRemainedEnemy) / (float)maxRemainedEnemy; var reverseRate = 1f - rate; currentIntervalTime = MyUtility.Interpolate(minIntervalTime, maxIntervalTime, reverseRate); }