new void Update() { base.Update(); if (maxTimer > 0f) { countTimer += Time.deltaTime; } SubUpdate(); if (followVector != FollowObject.transform.position) { DoUpdate = true; } followVector = FollowObject.transform.position; SeeLimit(); SeeFollow(); EulerAngle = VecComp.AbsDeg(EulerAngle); }
/// <summary> /// 視点の範囲制限、0~360で正規化 /// </summary> float SeeLimit(float value, ref float min, ref float max) { if ((max == 0f) && (min == 0f)) { return(value); } if (max < 0) { max = VecComp.AbsDeg(max); } if (min < 0) { min = VecComp.AbsDeg(min); } if (min > max) { float mid = (min + max) / 2; if (max < value && value < min) { if (mid >= value) { value = max; } else { value = min; } } } else { if (max < value) { value = max; } else if (min > value) { value = min; } } return(value); }