add 1st person smooth and skybox on-off setting

This commit is contained in:
xpeng
2022-07-29 20:18:13 +02:00
parent 593fe01d13
commit 19407e0da2
4 changed files with 158 additions and 30 deletions
@@ -4,6 +4,7 @@
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:2dcfcfc00d4ac7749bb60698b85f1dc2",
"GUID:80de51a1f88203a4cb129a5922de311f"
],
"includePlatforms": [],
@@ -9,6 +9,7 @@ public class PanelThirdPersonButton : MonoBehaviour
private Renderer cr;
public GameObject tpCamera;
public GameObject fpsCamera;
public AudioSource audioSrc;
void Start()
@@ -31,6 +32,7 @@ public class PanelThirdPersonButton : MonoBehaviour
isTP = state;
cr.material.color = state ? Color.green : Color.red;
tpCamera?.SetActive(state);
fpsCamera?.SetActive(!state);
JsonConfiguration.SetBoolean("ThirdPerson", state);
}
+11 -1
View File
@@ -12,6 +12,8 @@ public class SkyboxSwitcher : MonoBehaviour
private string skyboxPath;
public List<Texture2D> textures = new List<Texture2D>();
public List<System.IntPtr> ptrs = new List<System.IntPtr>();
public static bool useSkybox = false;
public GameObject Room;
[SerializeField]
private List<Material> skyboxes;
@@ -28,9 +30,13 @@ public class SkyboxSwitcher : MonoBehaviour
void Start()
{
if (JsonConfiguration.HasKey("useSkybox")) useSkybox = JsonConfiguration.GetBoolean("useSkybox");
else SaveSkyboxState();
Room.SetActive(!useSkybox);
if (JsonConfiguration.HasKey("Skybox")) currentSkyboxIndex = JsonConfiguration.GetInt("Skybox");
else SaveSkyboxIndex();
incrementBtn.ButtonPressed += IncrementEvent;
decrementBtn.ButtonPressed += DecrementEvent;
@@ -133,4 +139,8 @@ public class SkyboxSwitcher : MonoBehaviour
{
JsonConfiguration.SetInt("Skybox", currentSkyboxIndex);
}
private void SaveSkyboxState()
{
JsonConfiguration.SetBoolean("useSkybox", useSkybox);
}
}