Browse Source

Template Level

main
Joshua Reason 2 years ago
parent
commit
da76e3019a
10 changed files with 2045 additions and 147 deletions
  1. +529
    -0
      Assets/Prefabs/2D Camera.prefab
  2. +1
    -1
      Assets/Prefabs/Chest.prefab
  3. +1362
    -0
      Assets/Prefabs/Grid.prefab
  4. +7
    -0
      Assets/Prefabs/Grid.prefab.meta
  5. +3
    -3
      Assets/Prefabs/Level Manager.prefab
  6. +1
    -1
      Assets/Prefabs/Player.prefab
  7. BIN
      Assets/Scenes/Template Level.unity
  8. +137
    -137
      Assets/Scripts/Character/CharacterController2D.cs
  9. BIN
      Assets/Variables/Runtime/freezePlayer.asset
  10. +1
    -1
      Assets/Variables/Runtime/freezePlayer.asset.meta

+ 529
- 0
Assets/Prefabs/2D Camera.prefab View File

@ -1,5 +1,514 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &991955819
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 991955820}
- component: {fileID: 991955821}
- component: {fileID: 991955822}
m_Layer: 0
m_Name: clouds3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &991955820
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991955819}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 11.93, y: 7.36, z: 7.35}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1980583001}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &991955821
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991955819}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 716755205
m_SortingLayer: -2
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: d91e7f5ee5db7fc4ca19c938de0f18f9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 3.38, y: 0.93}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &991955822
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991955819}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c27236bc6c2676e4bbfdb1265c9f7936, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 2742648452306802123}
parallaxEffect_x: 0.5
parallaxEffect_y: 0.75
--- !u!1 &1342333370
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1342333371}
- component: {fileID: 1342333372}
m_Layer: 0
m_Name: clouds1 (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1342333371
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1342333370}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 47.13, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2114733606}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &1342333372
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1342333370}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 716755205
m_SortingLayer: -2
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: e5836e3da1090b340858ddae5d951007, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 3.73, y: 0.85}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1619515973
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1619515974}
- component: {fileID: 1619515975}
- component: {fileID: 1619515976}
m_Layer: 0
m_Name: sky
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1619515974
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1619515973}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 10.84, y: 6.4, z: 7.35}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1980583001}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &1619515975
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1619515973}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 716755205
m_SortingLayer: -2
m_SortingOrder: -2
m_Sprite: {fileID: 21300000, guid: a7c69fe92097f3847aa94f42da7b6c71, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 60, y: 42.666668}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &1619515976
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1619515973}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c27236bc6c2676e4bbfdb1265c9f7936, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 2742648452306802123}
parallaxEffect_x: 0.8
parallaxEffect_y: 0.9
--- !u!1 &1980583000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1980583001}
m_Layer: 0
m_Name: Skybox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1980583001
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1980583000}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -18.85, y: -2.7799995, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
m_Children:
- {fileID: 1619515974}
- {fileID: 991955820}
- {fileID: 2105864170}
- {fileID: 2114733606}
m_Father: {fileID: 2742648452306802124}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2105864169
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2105864170}
- component: {fileID: 2105864171}
- component: {fileID: 2105864172}
m_Layer: 0
m_Name: clouds2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2105864170
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2105864169}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 11.59, y: 7.35, z: 7.35}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1980583001}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2105864171
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2105864169}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 716755205
m_SortingLayer: -2
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 68655834732f032459c9233084df4daf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5.43, y: 0.93}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &2105864172
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2105864169}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c27236bc6c2676e4bbfdb1265c9f7936, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 2742648452306802123}
parallaxEffect_x: 0.43
parallaxEffect_y: 0.7
--- !u!1 &2114733605
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2114733606}
- component: {fileID: 2114733607}
- component: {fileID: 2114733608}
m_Layer: 0
m_Name: clouds1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2114733606
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114733605}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 11.51, y: 7.9400005, z: 7.35}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1342333371}
m_Father: {fileID: 1980583001}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2114733607
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114733605}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 716755205
m_SortingLayer: -2
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: e5836e3da1090b340858ddae5d951007, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 3.73, y: 0.85}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &2114733608
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114733605}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c27236bc6c2676e4bbfdb1265c9f7936, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 2742648452306802123}
parallaxEffect_x: 0.38
parallaxEffect_y: 0.65
--- !u!1 &2742648450655999644 --- !u!1 &2742648450655999644
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -123,6 +632,7 @@ GameObject:
- component: {fileID: 2742648452306802122} - component: {fileID: 2742648452306802122}
- component: {fileID: 2742648452306802127} - component: {fileID: 2742648452306802127}
- component: {fileID: 2742648452306802129} - component: {fileID: 2742648452306802129}
- component: {fileID: 7035977061392704193}
m_Layer: 0 m_Layer: 0
m_Name: 2D Camera m_Name: 2D Camera
m_TagString: Untagged m_TagString: Untagged
@ -142,6 +652,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 2742648450655999647} - {fileID: 2742648450655999647}
- {fileID: 1980583001}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -230,3 +741,21 @@ MonoBehaviour:
m_CropFrameX: 0 m_CropFrameX: 0
m_CropFrameY: 0 m_CropFrameY: 0
m_StretchFill: 0 m_StretchFill: 0
--- !u!114 &7035977061392704193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2742648452306802123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2b7796aef2c9a634e943d7b131c0b13f, type: 3}
m_Name:
m_EditorClassIdentifier:
Player: {fileID: 0}
m_FollowStrength: 3
m_FollowX: 1
m_FollowY: 0
m_OffsetX: 0
m_OffsetY: 2

+ 1
- 1
Assets/Prefabs/Chest.prefab View File

@ -248,7 +248,7 @@ MonoBehaviour:
m_chestAnimator: {fileID: 122265940559413430} m_chestAnimator: {fileID: 122265940559413430}
m_playerAnimator: {fileID: 0} m_playerAnimator: {fileID: 0}
m_freezePlayer: m_freezePlayer:
Variable: {fileID: 11400000, guid: ea1cffffa7e1ed34ca1fe3d3af13777c, type: 2}
Variable: {fileID: 11400000, guid: 4644ea58ce4d81544b22caddc5e66c86, type: 2}
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_isVictory: m_isVictory:

+ 1362
- 0
Assets/Prefabs/Grid.prefab
File diff suppressed because it is too large
View File


+ 7
- 0
Assets/Prefabs/Grid.prefab.meta View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f7ac6ce9e3572854a996ff974cc8c462
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 3
- 3
Assets/Prefabs/Level Manager.prefab View File

@ -331,7 +331,7 @@ MonoBehaviour:
m_timerText: {fileID: 5467881121094036215} m_timerText: {fileID: 5467881121094036215}
m_goText: {fileID: 5467881121402791696} m_goText: {fileID: 5467881121402791696}
m_freezePlayer: m_freezePlayer:
Variable: {fileID: 11400000, guid: ea1cffffa7e1ed34ca1fe3d3af13777c, type: 2}
Variable: {fileID: 11400000, guid: 4644ea58ce4d81544b22caddc5e66c86, type: 2}
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_manager: {fileID: 5467881121666507907} m_manager: {fileID: 5467881121666507907}
@ -894,7 +894,7 @@ MonoBehaviour:
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_freezePlayer: m_freezePlayer:
Variable: {fileID: 11400000, guid: ea1cffffa7e1ed34ca1fe3d3af13777c, type: 2}
Variable: {fileID: 11400000, guid: 4644ea58ce4d81544b22caddc5e66c86, type: 2}
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_isVictory: m_isVictory:
@ -914,7 +914,7 @@ MonoBehaviour:
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_backGround: {fileID: 5467881119753774637} m_backGround: {fileID: 5467881119753774637}
levelName: Level 1
levelName: Template Level
m_timeInLevel: 25 m_timeInLevel: 25
levelPrompt: This needs to be changed levelPrompt: This needs to be changed
m_resetTime: 1 m_resetTime: 1

+ 1
- 1
Assets/Prefabs/Player.prefab View File

@ -240,7 +240,7 @@ MonoBehaviour:
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_noInputAllowed: m_noInputAllowed:
Variable: {fileID: 11400000, guid: ea1cffffa7e1ed34ca1fe3d3af13777c, type: 2}
Variable: {fileID: 11400000, guid: 4644ea58ce4d81544b22caddc5e66c86, type: 2}
m_useLocal: 0 m_useLocal: 0
m_localValue: 0 m_localValue: 0
m_speed: 2 m_speed: 2

BIN
Assets/Scenes/Template Level.unity (Stored with Git LFS) View File

size 17983

+ 137
- 137
Assets/Scripts/Character/CharacterController2D.cs View File

@ -1,57 +1,57 @@
using UnityEngine;
using UnityEngine.Events;
public class CharacterController2D : MonoBehaviour
{
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
[SerializeField] private float m_WallJumpMultiplier = 3f; // Amount of force added when the player jumps off a wall.
[Range(0, 1)] [SerializeField] private float m_CrouchSpeed = .36f; // Amount of maxSpeed applied to crouching movement. 1 = 100%
[Range(0, .3f)] [SerializeField] private float m_MovementSmoothing = .05f; // How much to smooth out the movement
[SerializeField] private bool m_AirControl = false; // Whether or not a player can steer while jumping;
[SerializeField] private LayerMask m_WhatIsGround; // A mask determining what is ground to the character
[SerializeField] private Transform m_GroundCheck; // A position marking where to check if the player is grounded.
[SerializeField] private Transform m_CeilingCheck; // A position marking where to check for ceilings
[SerializeField] private Transform m_WallCheck;
[SerializeField] private Collider2D m_CrouchDisableCollider; // A collider that will be disabled when crouching
const float k_GroundedRadius = .2f; // Radius of the overlap circle to determine if grounded
private bool m_Grounded; // Whether or not the player is grounded.
private bool m_TouchingWall;
const float k_CeilingRadius = .2f; // Radius of the overlap circle to determine if the player can stand up
private Rigidbody2D m_Rigidbody2D;
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private Vector3 m_Velocity = Vector3.zero;
private enum Direction { NA=0, L, R };
private Direction m_LastWallJumpDirection = Direction.NA;
[Header("Events")]
[Space]
public UnityEvent OnLandEvent;
[System.Serializable]
public class BoolEvent : UnityEvent<bool> { }
public BoolEvent OnCrouchEvent;
private bool m_wasCrouching = false;
private void Awake()
{
m_Rigidbody2D = GetComponent<Rigidbody2D>();
if (OnLandEvent == null)
OnLandEvent = new UnityEvent();
if (OnCrouchEvent == null)
OnCrouchEvent = new BoolEvent();
}
private void FixedUpdate()
{
CheckGrounded();
CheckTouchingWall();
}
using UnityEngine;
using UnityEngine.Events;
public class CharacterController2D : MonoBehaviour
{
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
[SerializeField] private float m_WallJumpMultiplier = 3f; // Amount of force added when the player jumps off a wall.
[Range(0, 1)] [SerializeField] private float m_CrouchSpeed = .36f; // Amount of maxSpeed applied to crouching movement. 1 = 100%
[Range(0, .3f)] [SerializeField] private float m_MovementSmoothing = .05f; // How much to smooth out the movement
[SerializeField] private bool m_AirControl = false; // Whether or not a player can steer while jumping;
[SerializeField] private LayerMask m_WhatIsGround; // A mask determining what is ground to the character
[SerializeField] private Transform m_GroundCheck; // A position marking where to check if the player is grounded.
[SerializeField] private Transform m_CeilingCheck; // A position marking where to check for ceilings
[SerializeField] private Transform m_WallCheck;
[SerializeField] private Collider2D m_CrouchDisableCollider; // A collider that will be disabled when crouching
const float k_GroundedRadius = .2f; // Radius of the overlap circle to determine if grounded
private bool m_Grounded; // Whether or not the player is grounded.
private bool m_TouchingWall;
const float k_CeilingRadius = .2f; // Radius of the overlap circle to determine if the player can stand up
private Rigidbody2D m_Rigidbody2D;
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private Vector3 m_Velocity = Vector3.zero;
private enum Direction { NA=0, L, R };
private Direction m_LastWallJumpDirection = Direction.NA;
[Header("Events")]
[Space]
public UnityEvent OnLandEvent;
[System.Serializable]
public class BoolEvent : UnityEvent<bool> { }
public BoolEvent OnCrouchEvent;
private bool m_wasCrouching = false;
private void Awake()
{
m_Rigidbody2D = GetComponent<Rigidbody2D>();
if (OnLandEvent == null)
OnLandEvent = new UnityEvent();
if (OnCrouchEvent == null)
OnCrouchEvent = new BoolEvent();
}
private void FixedUpdate()
{
CheckGrounded();
CheckTouchingWall();
}
private void CheckGrounded() private void CheckGrounded()
{ {
bool wasGrounded = m_Grounded; bool wasGrounded = m_Grounded;
@ -67,8 +67,8 @@ public class CharacterController2D : MonoBehaviour
OnLandEvent.Invoke(); OnLandEvent.Invoke();
} }
} }
}
}
private void CheckTouchingWall() private void CheckTouchingWall()
{ {
m_TouchingWall = false; m_TouchingWall = false;
@ -80,80 +80,80 @@ public class CharacterController2D : MonoBehaviour
m_TouchingWall = true; m_TouchingWall = true;
} }
} }
}
public void Move(float move, bool crouch, bool jump)
{
// If crouching, check to see if the character can stand up
if (!crouch)
{
// If the character has a ceiling preventing them from standing up, keep them crouching
{
crouch = true;
}
}
//only control the player if grounded or airControl is turned on
if (m_Grounded || m_AirControl)
{
// If crouching
if (crouch)
{
if (!m_wasCrouching)
{
m_wasCrouching = true;
OnCrouchEvent.Invoke(true);
}
// Reduce the speed by the crouchSpeed multiplier
move *= m_CrouchSpeed;
// Disable one of the colliders when crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = false;
}
else
{
// Enable the collider when not crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = true;
if (m_wasCrouching)
{
m_wasCrouching = false;
OnCrouchEvent.Invoke(false);
}
}
// Move the character by finding the target velocity
Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
// And then smoothing it out and applying it to the character
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
// If the input is moving the player right and the player is facing left...
if (move > 0 && !m_FacingRight)
{
// ... flip the player.
Flip();
}
// Otherwise if the input is moving the player left and the player is facing right...
else if (move < 0 && m_FacingRight)
{
// ... flip the player.
Flip();
}
}
// If the player should jump...
if (m_Grounded && jump)
{
// Add a vertical force to the player.
m_Grounded = false;
}
public void Move(float move, bool crouch, bool jump)
{
// If crouching, check to see if the character can stand up
if (!crouch)
{
// If the character has a ceiling preventing them from standing up, keep them crouching
{
crouch = true;
}
}
//only control the player if grounded or airControl is turned on
if (m_Grounded || m_AirControl)
{
// If crouching
if (crouch)
{
if (!m_wasCrouching)
{
m_wasCrouching = true;
OnCrouchEvent.Invoke(true);
}
// Reduce the speed by the crouchSpeed multiplier
move *= m_CrouchSpeed;
// Disable one of the colliders when crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = false;
}
else
{
// Enable the collider when not crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = true;
if (m_wasCrouching)
{
m_wasCrouching = false;
OnCrouchEvent.Invoke(false);
}
}
// Move the character by finding the target velocity
Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
// And then smoothing it out and applying it to the character
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
// If the input is moving the player right and the player is facing left...
if (move > 0 && !m_FacingRight)
{
// ... flip the player.
Flip();
}
// Otherwise if the input is moving the player left and the player is facing right...
else if (move < 0 && m_FacingRight)
{
// ... flip the player.
Flip();
}
}
// If the player should jump...
if (m_Grounded && jump)
{
// Add a vertical force to the player.
m_Grounded = false;
m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce)); m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
// Reset wall jump switch // Reset wall jump switch
m_LastWallJumpDirection = move > 0 ? Direction.R : Direction.L;
}
m_LastWallJumpDirection = move > 0 ? Direction.R : Direction.L;
}
else if (m_TouchingWall && jump) else if (m_TouchingWall && jump)
{ {
if (m_FacingRight && m_LastWallJumpDirection == Direction.L) if (m_FacingRight && m_LastWallJumpDirection == Direction.L)
@ -173,14 +173,14 @@ public class CharacterController2D : MonoBehaviour
} }
private void Flip()
{
// Switch the way the player is labelled as facing.
m_FacingRight = !m_FacingRight;
// Multiply the player's x local scale by -1.
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
private void Flip()
{
// Switch the way the player is labelled as facing.
m_FacingRight = !m_FacingRight;
// Multiply the player's x local scale by -1.
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
} }

BIN
Assets/Variables/Runtime/freezePlayer.asset (Stored with Git LFS) View File

size 466

+ 1
- 1
Assets/Variables/Runtime/freezePlayer.asset.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ea1cffffa7e1ed34ca1fe3d3af13777c
guid: 4644ea58ce4d81544b22caddc5e66c86
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 11400000 mainObjectFileID: 11400000

Loading…
Cancel
Save