Skip to content

Commit

Permalink
Rename FloorHeightAdjust to FloorHeightAdjustMode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed May 30, 2021
1 parent 1ea913e commit 47e23b4
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Source/CustomAvatar/Configuration/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class Settings
public ObservableValue<bool> isAvatarVisibleInFirstPerson { get; } = new ObservableValue<bool>();
public ObservableValue<bool> moveFloorWithRoomAdjust { get; } = new ObservableValue<bool>();
public ObservableValue<AvatarResizeMode> resizeMode { get; } = new ObservableValue<AvatarResizeMode>(AvatarResizeMode.Height);
public ObservableValue<FloorHeightAdjust> floorHeightAdjust { get; } = new ObservableValue<FloorHeightAdjust>(FloorHeightAdjust.Off);
public ObservableValue<FloorHeightAdjustMode> floorHeightAdjust { get; } = new ObservableValue<FloorHeightAdjustMode>(FloorHeightAdjustMode.Off);
public string previousAvatarPath { get; set; }
public ObservableValue<float> playerArmSpan { get; } = new ObservableValue<float>(VRPlayerInput.kDefaultPlayerArmSpan);
public bool calibrateFullBodyTrackingOnStart { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Source/CustomAvatar/Player/EnvironmentObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void OnAvatarScaleChanged(float scale)
UpdateOffset();
}

private void OnFloorHeightAdjustChanged(FloorHeightAdjust value)
private void OnFloorHeightAdjustChanged(FloorHeightAdjustMode value)
{
UpdateOffset();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/CustomAvatar/Player/FloorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void OnAvatarScaleChanged(float scale)
floorPositionChanged?.Invoke(floorPosition);
}

private void OnFloorHeightAdjustChanged(FloorHeightAdjust floorHeightAdjust)
private void OnFloorHeightAdjustChanged(FloorHeightAdjustMode floorHeightAdjust)
{
floorPositionChanged?.Invoke(floorPosition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace CustomAvatar.Player
{
internal enum FloorHeightAdjust
internal enum FloorHeightAdjustMode
{
Off,
PlayersPlaceOnly,
Expand Down
4 changes: 2 additions & 2 deletions Source/CustomAvatar/Player/GameEnvironmentObjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public void Initialize()
{
switch (_settings.floorHeightAdjust.value)
{
case FloorHeightAdjust.EntireEnvironment:
case FloorHeightAdjustMode.EntireEnvironment:
_container.InstantiateComponent<EnvironmentObject>(GameObject.Find("/Environment"));
break;

case FloorHeightAdjust.PlayersPlaceOnly:
case FloorHeightAdjustMode.PlayersPlaceOnly:
var environment = GameObject.Find("/Environment");

_container.InstantiateComponent<EnvironmentObject>(environment.transform.Find("PlayersPlace").gameObject);
Expand Down
2 changes: 1 addition & 1 deletion Source/CustomAvatar/Player/KeyboardInputHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void Tick()
}
else if (Input.GetKeyDown(KeyCode.Insert))
{
_settings.floorHeightAdjust.value = (FloorHeightAdjust)(((int)_settings.floorHeightAdjust.value + 1) % Enum.GetValues(typeof(FloorHeightAdjust)).Length);
_settings.floorHeightAdjust.value = (FloorHeightAdjustMode)(((int)_settings.floorHeightAdjust.value + 1) % Enum.GetValues(typeof(FloorHeightAdjustMode)).Length);
_logger.Info($"Set floor height adjust to {_settings.floorHeightAdjust}");
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/CustomAvatar/Player/PlayerAvatarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ internal void SetParent(Transform transform)

internal float GetFloorOffset()
{
if (_settings.floorHeightAdjust == FloorHeightAdjust.Off || !currentlySpawnedAvatar) return 0;
if (_settings.floorHeightAdjust == FloorHeightAdjustMode.Off || !currentlySpawnedAvatar) return 0;

return _beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight() - currentlySpawnedAvatar.scaledEyeHeight;
}
Expand All @@ -438,7 +438,7 @@ private void OnResizeModeChanged(AvatarResizeMode resizeMode)
ResizeCurrentAvatar();
}

private void OnFloorHeightAdjustChanged(FloorHeightAdjust floorHeightAdjust)
private void OnFloorHeightAdjustChanged(FloorHeightAdjustMode floorHeightAdjust)
{
ResizeCurrentAvatar();
}
Expand Down
14 changes: 7 additions & 7 deletions Source/CustomAvatar/UI/GeneralSettingsHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal class GeneralSettingsHost : IViewControllerHost
#pragma warning disable IDE0052

[UIValue("resize-mode-options")] private readonly List<object> _resizeModeOptions = new List<object> { AvatarResizeMode.None, AvatarResizeMode.Height, AvatarResizeMode.ArmSpan };
[UIValue("floor-height-adjust-options")] private readonly List<object> _floorHeightAdjustOptions = new List<object> { FloorHeightAdjust.Off, FloorHeightAdjust.PlayersPlaceOnly, FloorHeightAdjust.EntireEnvironment };
[UIValue("floor-height-adjust-options")] private readonly List<object> _floorHeightAdjustOptions = new List<object> { FloorHeightAdjustMode.Off, FloorHeightAdjustMode.PlayersPlaceOnly, FloorHeightAdjustMode.EntireEnvironment };

#pragma warning restore IDE0052
#endregion
Expand Down Expand Up @@ -165,23 +165,23 @@ private void OnEnableLocomotionChanged(bool value)
[UIAction("floor-height-adjust-formatter")]
private string FloorHeightAdjustFormatter(object value)
{
if (!(value is FloorHeightAdjust)) return null;
if (!(value is FloorHeightAdjustMode)) return null;

switch ((FloorHeightAdjust)value)
switch ((FloorHeightAdjustMode)value)
{
case FloorHeightAdjust.Off:
case FloorHeightAdjustMode.Off:
return "Off";
case FloorHeightAdjust.PlayersPlaceOnly:
case FloorHeightAdjustMode.PlayersPlaceOnly:
return "Player's Place Only";
case FloorHeightAdjust.EntireEnvironment:
case FloorHeightAdjustMode.EntireEnvironment:
return "Entire Environment";
default:
return null;
}
}

[UIAction("floor-height-adjust-change")]
private void OnFloorHeightAdjustChanged(FloorHeightAdjust value)
private void OnFloorHeightAdjustChanged(FloorHeightAdjustMode value)
{
_settings.floorHeightAdjust.value = value;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/CustomAvatar/Utilities/TrackingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void ApplyInverseRoomAdjust(ref Vector3 position, ref Quaternion rotation
/// </summary>
public void ApplyFloorOffset(SpawnedAvatar spawnedAvatar, ref Vector3 position)
{
if (_settings.floorHeightAdjust == FloorHeightAdjust.Off || !spawnedAvatar) return;
if (_settings.floorHeightAdjust == FloorHeightAdjustMode.Off || !spawnedAvatar) return;

position.y += spawnedAvatar.scaledEyeHeight - _beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight();
}
Expand All @@ -113,7 +113,7 @@ public void ApplyFloorOffset(SpawnedAvatar spawnedAvatar, ref Vector3 position)
/// </summary>
public void ApplyFloorScaling(SpawnedAvatar spawnedAvatar, ref Vector3 position)
{
if (_settings.floorHeightAdjust == FloorHeightAdjust.Off || !spawnedAvatar) return;
if (_settings.floorHeightAdjust == FloorHeightAdjustMode.Off || !spawnedAvatar) return;

position.y *= spawnedAvatar.scaledEyeHeight / _beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight();
}
Expand All @@ -124,7 +124,7 @@ public void ApplyFloorScaling(SpawnedAvatar spawnedAvatar, ref Vector3 position)
/// </summary>
public void ApplyInverseFloorScaling(SpawnedAvatar spawnedAvatar, ref Vector3 position)
{
if (_settings.floorHeightAdjust == FloorHeightAdjust.Off || !spawnedAvatar) return;
if (_settings.floorHeightAdjust == FloorHeightAdjustMode.Off || !spawnedAvatar) return;

position.y /= spawnedAvatar.scaledEyeHeight / _beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight();
}
Expand Down

0 comments on commit 47e23b4

Please sign in to comment.