From 8aa168505d4d62c88101c29d5bddcc74dd8ec359 Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 29 Jan 2022 03:25:16 +0100 Subject: [PATCH] Complete speed platform --- Assets/Prefabs/Platform.prefab | 14 -- Assets/Prefabs/Platform_Blue.prefab | 14 -- Assets/Prefabs/Platform_Green.prefab | 14 -- Assets/Prefabs/Platform_yellow.prefab | 16 +- Assets/Scenes/Haitem.unity | 259 +++++++++++++++++--------- Assets/Scripts/PlatformManager.cs | 5 +- Assets/Scripts/PlayerController.cs | 5 + UserSettings/EditorUserSettings.asset | 7 +- 8 files changed, 187 insertions(+), 147 deletions(-) diff --git a/Assets/Prefabs/Platform.prefab b/Assets/Prefabs/Platform.prefab index 8d6e0f1..011a3d1 100644 --- a/Assets/Prefabs/Platform.prefab +++ b/Assets/Prefabs/Platform.prefab @@ -14,7 +14,6 @@ GameObject: - component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709948} - component: {fileID: 3861707493128515586} - - component: {fileID: 5765921883283663682} m_Layer: 0 m_Name: Platform m_TagString: platform @@ -129,16 +128,3 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: type: 0 ---- !u!65 &5765921883283663682 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 1, z: 0} diff --git a/Assets/Prefabs/Platform_Blue.prefab b/Assets/Prefabs/Platform_Blue.prefab index a709f8b..2c65de3 100644 --- a/Assets/Prefabs/Platform_Blue.prefab +++ b/Assets/Prefabs/Platform_Blue.prefab @@ -14,7 +14,6 @@ GameObject: - component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709948} - component: {fileID: 1430690303722568316} - - component: {fileID: 4716169668968050713} m_Layer: 0 m_Name: Platform_Blue m_TagString: platform @@ -129,16 +128,3 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: type: 0 ---- !u!65 &4716169668968050713 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 1, z: 0} diff --git a/Assets/Prefabs/Platform_Green.prefab b/Assets/Prefabs/Platform_Green.prefab index 08e8e8b..62a2d4e 100644 --- a/Assets/Prefabs/Platform_Green.prefab +++ b/Assets/Prefabs/Platform_Green.prefab @@ -14,7 +14,6 @@ GameObject: - component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709948} - component: {fileID: 3339862426328537977} - - component: {fileID: 1376546613772517290} m_Layer: 0 m_Name: Platform_Green m_TagString: platform @@ -129,16 +128,3 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: type: 1 ---- !u!65 &1376546613772517290 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 1, z: 0} diff --git a/Assets/Prefabs/Platform_yellow.prefab b/Assets/Prefabs/Platform_yellow.prefab index a4e4d75..f6c83b2 100644 --- a/Assets/Prefabs/Platform_yellow.prefab +++ b/Assets/Prefabs/Platform_yellow.prefab @@ -14,7 +14,6 @@ GameObject: - component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709948} - component: {fileID: 7821003709828495146} - - component: {fileID: 8066117290360009672} m_Layer: 0 m_Name: Platform_yellow m_TagString: platform @@ -128,17 +127,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fdc803964e5f2b042bece1765b69164f, type: 3} m_Name: m_EditorClassIdentifier: - type: 2 ---- !u!65 &8066117290360009672 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 1, z: 0} + type: 4 diff --git a/Assets/Scenes/Haitem.unity b/Assets/Scenes/Haitem.unity index adc70bf..b6a1906 100644 --- a/Assets/Scenes/Haitem.unity +++ b/Assets/Scenes/Haitem.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -123,6 +123,63 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &359653079 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3244356567786994344, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalPosition.y + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3} --- !u!1 &447415686 GameObject: m_ObjectHideFlags: 0 @@ -215,89 +272,119 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &1342339029 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1342339032} - - component: {fileID: 1342339031} - - component: {fileID: 1342339030} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &1342339030 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1342339029} - m_Enabled: 1 ---- !u!20 &1342339031 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1342339029} - 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: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - 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 &1342339032 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1342339029} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -10} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1001 &1599610786 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709947, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} + propertyPath: m_Name + value: Platform_Blue + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 97d4c453fb5affa448968cb5ce9ca2f4, type: 3} +--- !u!1001 &1886271006 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalPosition.x + value: 0.07708883 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalPosition.z + value: 21.686787 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709944, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8768991388683709947, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} + propertyPath: m_Name + value: Platform_yellow + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1e3f34788e0cb3f49a0bef285d5b059a, type: 3} diff --git a/Assets/Scripts/PlatformManager.cs b/Assets/Scripts/PlatformManager.cs index 42a994b..cb8f401 100644 --- a/Assets/Scripts/PlatformManager.cs +++ b/Assets/Scripts/PlatformManager.cs @@ -6,6 +6,7 @@ public class PlatformManager : MonoBehaviour { public enum PlatformType {Pull, Push, RotateZ, RotateY, Speed}; public PlatformType type = PlatformType.Pull; + public float speed = 5; void Start() { @@ -16,9 +17,9 @@ public class PlatformManager : MonoBehaviour { if (type == PlatformType.RotateZ) { - transform.Rotate(transform.forward); + transform.Rotate(transform.forward * speed * Time.deltaTime); } else if (type == PlatformType.RotateY) { - transform.Rotate(transform.up); + transform.Rotate(transform.up * speed * Time.deltaTime); } } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 51d0f74..98acfd3 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -97,6 +97,11 @@ public class PlayerController : MonoBehaviour { gDirection = -transform.up; } + else if (platform != null && platform.type == PlatformManager.PlatformType.Speed) + { + rb.AddForce(other.transform.forward * platform.speed * 10 * Time.deltaTime, ForceMode.Impulse); + gDirection = -transform.up; + } else { gDirection = -transform.up; diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 7fab481..1452354 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -8,6 +8,9 @@ EditorUserSettings: RecentlyUsedSceneGuid-0: value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a flags: 0 + RecentlyUsedSceneGuid-1: + value: 5b53500307070b0b0b0f5a2648735a4412154f737d2b2536782f1e32e0b86c3a + flags: 0 RecentlyUsedScenePath-0: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 @@ -19,8 +22,8 @@ EditorUserSettings: m_VCDebugCmd: 0 m_VCDebugOut: 0 m_SemanticMergeMode: 2 - m_DesiredImportWorkerCount: 1 - m_StandbyImportWorkerCount: 1 + m_DesiredImportWorkerCount: 3 + m_StandbyImportWorkerCount: 2 m_IdleImportWorkerShutdownDelay: 60000 m_VCShowFailedCheckout: 1 m_VCOverwriteFailedCheckoutAssets: 1