Skip to content

Commit

Permalink
add keybind for switching camera view modes as per #9
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbrownmsm committed Dec 1, 2024
1 parent 417b184 commit 35134fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Scripts/ui/PauseUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void SetupCallbacks()
fieldOrientedControl.value = SettingsManager.fieldOriented;
showHUD.value = SettingsManager.showHUD;

cameraDropdown.choices = new List<string> { "fixed", "mouse", "auto", "bird's eye", "cinematic"};
cameraDropdown.choices = SettingsManager.cameraViewModes;
cameraDropdown.value = SettingsManager.cameraView;

manualControlToggle.RegisterCallback<ClickEvent>(ToggleManualControl);
Expand Down
13 changes: 13 additions & 0 deletions Assets/Scripts/ui/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class SettingsManager : MonoBehaviour {
public static string cameraView;

public static bool needToSetPosition = false;
public static List<string> cameraViewModes = new List<string> { "fixed", "mouse", "auto", "bird's eye", "cinematic" };
private static int cameraViewIndex = 0;

void Awake() {
if (Instance != null) {
Expand Down Expand Up @@ -50,6 +52,17 @@ void Update() {
SceneManager.UnloadSceneAsync("pauseMenu");
}
}

cameraViewIndex = cameraViewModes.FindIndex(x => x.Equals(cameraView));

if (Input.GetKeyDown("c") || Input.GetKeyDown("right ctrl") || Input.GetKeyDown("left ctrl")) {
cameraViewIndex += 1;
if (cameraViewIndex > cameraViewModes.Count-1) {
cameraViewIndex = 0;
}

cameraView = cameraViewModes[cameraViewIndex];
}
}

public static void SavePreferences() {
Expand Down

0 comments on commit 35134fe

Please sign in to comment.