1
0
mirror of synced 2024-11-14 18:17:40 +01:00

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

View File

@ -1527,7 +1527,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 10 m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &90549604 --- !u!65 &90549604
BoxCollider: BoxCollider:
@ -3259,6 +3259,132 @@ GameObject:
type: 3} type: 3}
m_PrefabInstance: {fileID: 1774209490} m_PrefabInstance: {fileID: 1774209490}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &263796134
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 263796138}
- component: {fileID: 263796137}
- component: {fileID: 263796136}
- component: {fileID: 263796135}
m_Layer: 0
m_Name: First-Person Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &263796135
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263796134}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e44f24d571d0baa46bacf3d93aca3592, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 1699975370}
smoothSpeed: 0.125
PositionOffset: {x: 0, y: 0, z: 0}
FPS: 60
--- !u!114 &263796136
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263796134}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 0
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
--- !u!20 &263796137
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263796134}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 46.915268
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &263796138
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263796134}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &265513286 --- !u!114 &265513286
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -9974,7 +10100,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &885474271 --- !u!23 &885474271
MeshRenderer: MeshRenderer:
@ -10258,7 +10384,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &910165458 --- !u!114 &910165458
MonoBehaviour: MonoBehaviour:
@ -10272,7 +10398,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c08c82d8bfafe7b4bb4386ab2dd79d9c, type: 3} m_Script: {fileID: 11500000, guid: c08c82d8bfafe7b4bb4386ab2dd79d9c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
inByte: 0
--- !u!114 &911618253 --- !u!114 &911618253
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11266,6 +11391,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isTP: 1 isTP: 1
tpCamera: {fileID: 1740661838} tpCamera: {fileID: 1740661838}
fpsCamera: {fileID: 0}
audioSrc: {fileID: 25651916} audioSrc: {fileID: 25651916}
--- !u!65 &998415429 --- !u!65 &998415429
BoxCollider: BoxCollider:
@ -12349,7 +12475,7 @@ PrefabInstance:
- target: {fileID: -8679921383154817045, guid: 31f0c3f4ace06884a8eb57730c1e9c57, - target: {fileID: -8679921383154817045, guid: 31f0c3f4ace06884a8eb57730c1e9c57,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 5 value: 6
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 31f0c3f4ace06884a8eb57730c1e9c57, - target: {fileID: -8679921383154817045, guid: 31f0c3f4ace06884a8eb57730c1e9c57,
type: 3} type: 3}
@ -13966,7 +14092,6 @@ MonoBehaviour:
- {fileID: 802529247} - {fileID: 802529247}
- {fileID: 512944751} - {fileID: 512944751}
- {fileID: 215619937} - {fileID: 215619937}
Materials: []
FadeDuration: 0.5 FadeDuration: 0.5
--- !u!4 &1251312952 --- !u!4 &1251312952
Transform: Transform:
@ -13981,7 +14106,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 10
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!23 &1251312953 --- !u!23 &1251312953
MeshRenderer: MeshRenderer:
@ -15976,6 +16101,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
textures: [] textures: []
Room: {fileID: 2035027796}
skyboxes: skyboxes:
- {fileID: 2100000, guid: 0ba3af3c38a13144aa37791cc1c0dca2, type: 2} - {fileID: 2100000, guid: 0ba3af3c38a13144aa37791cc1c0dca2, type: 2}
currentSkyboxIndex: 0 currentSkyboxIndex: 0
@ -17251,7 +17377,7 @@ Transform:
- {fileID: 567364759} - {fileID: 567364759}
- {fileID: 25651915} - {fileID: 25651915}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: -27.917, z: 0} m_LocalEulerAnglesHint: {x: 0, y: -27.917, z: 0}
--- !u!1 &1681660568 stripped --- !u!1 &1681660568 stripped
GameObject: GameObject:
@ -17453,7 +17579,7 @@ GameObject:
m_IsActive: 1 m_IsActive: 1
--- !u!4 &1699975370 --- !u!4 &1699975370
Transform: Transform:
m_ObjectHideFlags: 8 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
@ -17852,7 +17978,6 @@ GameObject:
- component: {fileID: 1740661842} - component: {fileID: 1740661842}
- component: {fileID: 1740661841} - component: {fileID: 1740661841}
- component: {fileID: 1740661839} - component: {fileID: 1740661839}
- component: {fileID: 1740661843}
m_Layer: 0 m_Layer: 0
m_Name: Third-Person Camera m_Name: Third-Person Camera
m_TagString: Untagged m_TagString: Untagged
@ -17950,24 +18075,8 @@ Transform:
m_Children: m_Children:
- {fileID: 1688695918} - {fileID: 1688695918}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 7.278, y: 21.625, z: 0.272} m_LocalEulerAnglesHint: {x: 7.278, y: 21.625, z: 0.272}
--- !u!114 &1740661843
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1740661838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e44f24d571d0baa46bacf3d93aca3592, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 1699975370}
smoothSpeed: 0
PositionOffset: {x: 0, y: 0, z: 0}
FPS: 60
--- !u!65 &1744786996 --- !u!65 &1744786996
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -18402,7 +18511,7 @@ PrefabInstance:
- target: {fileID: -8679921383154817045, guid: cf8684b3c4f47b94aa7cb23ce498caf3, - target: {fileID: -8679921383154817045, guid: cf8684b3c4f47b94aa7cb23ce498caf3,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 4 value: 5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: cf8684b3c4f47b94aa7cb23ce498caf3, - target: {fileID: -8679921383154817045, guid: cf8684b3c4f47b94aa7cb23ce498caf3,
type: 3} type: 3}
@ -27791,7 +27900,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 11 m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1840065107 --- !u!65 &1840065107
BoxCollider: BoxCollider:
@ -32078,6 +32187,12 @@ MeshRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0} m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &2035027796 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 31f0c3f4ace06884a8eb57730c1e9c57,
type: 3}
m_PrefabInstance: {fileID: 1111700630}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2035529421 stripped --- !u!1 &2035529421 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 3685730726848748902, guid: cf8684b3c4f47b94aa7cb23ce498caf3, m_CorrespondingSourceObject: {fileID: 3685730726848748902, guid: cf8684b3c4f47b94aa7cb23ce498caf3,

View File

@ -4,6 +4,7 @@
"references": [ "references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f", "GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:75469ad4d38634e559750d17036d5f7c", "GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:2dcfcfc00d4ac7749bb60698b85f1dc2",
"GUID:80de51a1f88203a4cb129a5922de311f" "GUID:80de51a1f88203a4cb129a5922de311f"
], ],
"includePlatforms": [], "includePlatforms": [],

View File

@ -9,6 +9,7 @@ public class PanelThirdPersonButton : MonoBehaviour
private Renderer cr; private Renderer cr;
public GameObject tpCamera; public GameObject tpCamera;
public GameObject fpsCamera;
public AudioSource audioSrc; public AudioSource audioSrc;
void Start() void Start()
@ -31,6 +32,7 @@ public class PanelThirdPersonButton : MonoBehaviour
isTP = state; isTP = state;
cr.material.color = state ? Color.green : Color.red; cr.material.color = state ? Color.green : Color.red;
tpCamera?.SetActive(state); tpCamera?.SetActive(state);
fpsCamera?.SetActive(!state);
JsonConfiguration.SetBoolean("ThirdPerson", state); JsonConfiguration.SetBoolean("ThirdPerson", state);
} }

View File

@ -12,6 +12,8 @@ public class SkyboxSwitcher : MonoBehaviour
private string skyboxPath; private string skyboxPath;
public List<Texture2D> textures = new List<Texture2D>(); public List<Texture2D> textures = new List<Texture2D>();
public List<System.IntPtr> ptrs = new List<System.IntPtr>(); public List<System.IntPtr> ptrs = new List<System.IntPtr>();
public static bool useSkybox = false;
public GameObject Room;
[SerializeField] [SerializeField]
private List<Material> skyboxes; private List<Material> skyboxes;
@ -28,9 +30,13 @@ public class SkyboxSwitcher : MonoBehaviour
void Start() void Start()
{ {
if (JsonConfiguration.HasKey("useSkybox")) useSkybox = JsonConfiguration.GetBoolean("useSkybox");
else SaveSkyboxState();
Room.SetActive(!useSkybox);
if (JsonConfiguration.HasKey("Skybox")) currentSkyboxIndex = JsonConfiguration.GetInt("Skybox"); if (JsonConfiguration.HasKey("Skybox")) currentSkyboxIndex = JsonConfiguration.GetInt("Skybox");
else SaveSkyboxIndex(); else SaveSkyboxIndex();
incrementBtn.ButtonPressed += IncrementEvent; incrementBtn.ButtonPressed += IncrementEvent;
decrementBtn.ButtonPressed += DecrementEvent; decrementBtn.ButtonPressed += DecrementEvent;
@ -133,4 +139,8 @@ public class SkyboxSwitcher : MonoBehaviour
{ {
JsonConfiguration.SetInt("Skybox", currentSkyboxIndex); JsonConfiguration.SetInt("Skybox", currentSkyboxIndex);
} }
private void SaveSkyboxState()
{
JsonConfiguration.SetBoolean("useSkybox", useSkybox);
}
} }