Pull request #8: Obstacles
Merge in CEGJ/32bit_jam_conjure from Obstacles to Dev * commit '6b5c481c6f38e6dc695dc890ec8981c05b56fd12': Trigger zone can trigger triggerable obj Example in SlidingDoor in Obstacle scene Stuns can knockback player in chosen dir Moved stun logic to obj instead of player Colliding with certain obj can stun the player
This commit is contained in:
commit
21b87a28d3
@ -16,9 +16,10 @@ GameObject:
|
|||||||
- component: {fileID: 1772573266731274173}
|
- component: {fileID: 1772573266731274173}
|
||||||
- component: {fileID: 1772573266731274172}
|
- component: {fileID: 1772573266731274172}
|
||||||
- component: {fileID: 1772573266731274163}
|
- component: {fileID: 1772573266731274163}
|
||||||
|
- component: {fileID: 8474203461765366282}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Untagged
|
m_TagString: Player
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
@ -293,6 +294,18 @@ MonoBehaviour:
|
|||||||
playerHeight: 0.5
|
playerHeight: 0.5
|
||||||
isGrounded: 0
|
isGrounded: 0
|
||||||
isJumping: 0
|
isJumping: 0
|
||||||
|
--- !u!114 &8474203461765366282
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1772573266731274171}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9b5fa9960655cb742880ef94db81ca9c, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1772573266864950258
|
--- !u!1 &1772573266864950258
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
241
Assets/Prefabs/TriggerDoor.prefab
Normal file
241
Assets/Prefabs/TriggerDoor.prefab
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1243356202599863082
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7209283580179404153}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: OpenPos
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7209283580179404153
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1243356202599863082}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 6.75, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2266619454732308705}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &2266619454697635466
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2266619454697635461}
|
||||||
|
- component: {fileID: 2266619454697635462}
|
||||||
|
- component: {fileID: 2266619454697635463}
|
||||||
|
- component: {fileID: 2266619454697635464}
|
||||||
|
- component: {fileID: 2266619454697635465}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Cube
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2266619454697635461
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454697635466}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 2, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 4, z: 6.063366}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2266619454732308705}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &2266619454697635462
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454697635466}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &2266619454697635463
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454697635466}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
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: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!65 &2266619454697635464
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454697635466}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &2266619454697635465
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454697635466}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 90c46c64cc336b6409943094eb9dedcf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
openPos: {fileID: 7209283580179404153}
|
||||||
|
openSpeed: 5
|
||||||
|
--- !u!1 &2266619454732308706
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2266619454732308705}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TriggerDoor
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2266619454732308705
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619454732308706}
|
||||||
|
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:
|
||||||
|
- {fileID: 2266619454697635461}
|
||||||
|
- {fileID: 2266619455371308420}
|
||||||
|
- {fileID: 7209283580179404153}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &2266619455371308423
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2266619455371308420}
|
||||||
|
- component: {fileID: 2266619455371308421}
|
||||||
|
- component: {fileID: 2266619455371308422}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TriggerZone
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2266619455371308420
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619455371308423}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: -2.6, y: 1, z: 0}
|
||||||
|
m_LocalScale: {x: 6.2, y: 2, z: 14.33}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2266619454732308705}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &2266619455371308421
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619455371308423}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 90baab3719135f24bb2f7611276bf3ab, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
linkedObj: {fileID: 2266619454697635465}
|
||||||
|
onEnter: 1
|
||||||
|
onStay: 0
|
||||||
|
OnExit: 1
|
||||||
|
--- !u!65 &2266619455371308422
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2266619455371308423}
|
||||||
|
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: 0, z: 0}
|
||||||
7
Assets/Prefabs/TriggerDoor.prefab.meta
Normal file
7
Assets/Prefabs/TriggerDoor.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5929ab1e380d0d24eb14edf221c4e219
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -542,7 +542,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 335131023}
|
m_GameObject: {fileID: 335131023}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 16.07, y: 10.1, z: 0}
|
m_LocalPosition: {x: 9.4, y: 16.4, z: 0}
|
||||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@ -1456,6 +1456,7 @@ GameObject:
|
|||||||
- component: {fileID: 952326955}
|
- component: {fileID: 952326955}
|
||||||
- component: {fileID: 952326954}
|
- component: {fileID: 952326954}
|
||||||
- component: {fileID: 952326953}
|
- component: {fileID: 952326953}
|
||||||
|
- component: {fileID: 952326957}
|
||||||
m_Layer: 3
|
m_Layer: 3
|
||||||
m_Name: Floor_02
|
m_Name: Floor_02
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -1541,6 +1542,21 @@ Transform:
|
|||||||
m_Father: {fileID: 778227310}
|
m_Father: {fileID: 778227310}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &952326957
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 952326952}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3a94b6c0021fca74ba1778a83054fbe8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
duration: 1
|
||||||
|
knockback: 1
|
||||||
|
stunDir: {x: 1000, y: 1000}
|
||||||
--- !u!1 &1070079036
|
--- !u!1 &1070079036
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1968,7 +1984,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 1772573266731274175, guid: 4dbf735f9da7b9f43b69f1577e4e5763,
|
- target: {fileID: 1772573266731274175, guid: 4dbf735f9da7b9f43b69f1577e4e5763,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 8.5106
|
value: 5.43
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1772573266731274175, guid: 4dbf735f9da7b9f43b69f1577e4e5763,
|
- target: {fileID: 1772573266731274175, guid: 4dbf735f9da7b9f43b69f1577e4e5763,
|
||||||
type: 3}
|
type: 3}
|
||||||
@ -2102,7 +2118,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1530935835}
|
m_GameObject: {fileID: 1530935835}
|
||||||
m_LocalRotation: {x: 0.034568068, y: 0, z: 0, w: 0.99940234}
|
m_LocalRotation: {x: 0.034568068, y: 0, z: 0, w: 0.99940234}
|
||||||
m_LocalPosition: {x: 8.5106, y: 8.54, z: -22.81}
|
m_LocalPosition: {x: 5.43, y: 8.54, z: -22.81}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@ -2791,7 +2807,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2129712287}
|
m_GameObject: {fileID: 2129712287}
|
||||||
m_LocalRotation: {x: 0.034568068, y: 0, z: 0, w: 0.99940234}
|
m_LocalRotation: {x: 0.034568068, y: 0, z: 0, w: 0.99940234}
|
||||||
m_LocalPosition: {x: 8.5106, y: 8.54, z: -22.81}
|
m_LocalPosition: {x: 5.43, y: 8.54, z: -22.81}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
|||||||
2886
Assets/Scenes/Obstacles.unity
Normal file
2886
Assets/Scenes/Obstacles.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Obstacles.unity.meta
Normal file
7
Assets/Scenes/Obstacles.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 07aafb3371eaac641a71a3b3f66a2823
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -21,12 +21,15 @@ public class CharacterMovement : MonoBehaviour
|
|||||||
[SerializeField] private float playerHeight;
|
[SerializeField] private float playerHeight;
|
||||||
public bool isGrounded;
|
public bool isGrounded;
|
||||||
public bool isJumping;
|
public bool isJumping;
|
||||||
|
private bool isStunned = false;
|
||||||
|
|
||||||
private Vector3 rawInputMovement;
|
private Vector3 rawInputMovement;
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
if(isStunned){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (canWalk || canJump)
|
if (canWalk || canJump)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -62,6 +65,14 @@ public class CharacterMovement : MonoBehaviour
|
|||||||
rb.drag= airDrag;
|
rb.drag= airDrag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Stun(float duration){
|
||||||
|
isStunned = true;
|
||||||
|
Invoke("Unstun" ,duration);
|
||||||
|
}
|
||||||
|
private void Unstun(){
|
||||||
|
isStunned = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void Walk(InputAction.CallbackContext value){
|
public void Walk(InputAction.CallbackContext value){
|
||||||
|
|
||||||
if (canWalk)
|
if (canWalk)
|
||||||
|
|||||||
@ -39,11 +39,11 @@ public class GrappleHook : MonoBehaviour
|
|||||||
private SpringJoint joint;
|
private SpringJoint joint;
|
||||||
private LineRenderer lr;
|
private LineRenderer lr;
|
||||||
RaycastHit hit;
|
RaycastHit hit;
|
||||||
private bool grappled = false, grappling = false, boosted = false, changingLength = false;
|
private bool grappled = false, grappling = false, boosted = false, changingLength = false, isStunned = false;
|
||||||
float changingLengthDir = 0;
|
float changingLengthDir = 0;
|
||||||
private Vector3 currGrappleEndPos;
|
private Vector3 currGrappleEndPos;
|
||||||
|
|
||||||
|
#region private methods
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
lr = gameObject.GetComponentInChildren<LineRenderer>();
|
lr = gameObject.GetComponentInChildren<LineRenderer>();
|
||||||
@ -55,6 +55,9 @@ public class GrappleHook : MonoBehaviour
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if(isStunned){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(grappled){
|
if(grappled){
|
||||||
DrawRope(Time.deltaTime);
|
DrawRope(Time.deltaTime);
|
||||||
@ -121,6 +124,7 @@ public class GrappleHook : MonoBehaviour
|
|||||||
Rigidbody hitRb = hit.rigidbody;
|
Rigidbody hitRb = hit.rigidbody;
|
||||||
joint.connectedBody = hitRb;
|
joint.connectedBody = hitRb;
|
||||||
joint.connectedAnchor = hit.transform.InverseTransformPoint(hit.point);
|
joint.connectedAnchor = hit.transform.InverseTransformPoint(hit.point);
|
||||||
|
joint.enableCollision = true;
|
||||||
hitPosLocal = hit.transform.InverseTransformPoint(hit.point);
|
hitPosLocal = hit.transform.InverseTransformPoint(hit.point);
|
||||||
}else{
|
}else{
|
||||||
joint.connectedAnchor = hit.point;
|
joint.connectedAnchor = hit.point;
|
||||||
@ -153,6 +157,21 @@ public class GrappleHook : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UnStun(){
|
||||||
|
isStunned = false;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public methods
|
||||||
|
|
||||||
|
public void Stun(float duration){
|
||||||
|
isStunned = true;
|
||||||
|
EndGrapple();
|
||||||
|
Invoke("UnStun", duration);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region InputActions
|
||||||
public void Grapple(InputAction.CallbackContext context){
|
public void Grapple(InputAction.CallbackContext context){
|
||||||
if(grappling && grappled)return;
|
if(grappling && grappled)return;
|
||||||
if(context.performed){
|
if(context.performed){
|
||||||
@ -194,5 +213,5 @@ public class GrappleHook : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
32
Assets/Scripts/PlayerController.cs
Normal file
32
Assets/Scripts/PlayerController.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class PlayerController : MonoBehaviour
|
||||||
|
{
|
||||||
|
private GrappleHook grappleScript;
|
||||||
|
private CharacterMovement movementScript;
|
||||||
|
private Rigidbody rb;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
rb = GetComponent<Rigidbody>();
|
||||||
|
grappleScript = GetComponent<GrappleHook>();
|
||||||
|
movementScript = GetComponent<CharacterMovement>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stun(float duration){
|
||||||
|
grappleScript.Stun(duration);
|
||||||
|
movementScript.Stun(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Knockback(Vector2 dir){
|
||||||
|
rb.AddForce(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PlayerController.cs.meta
Normal file
11
Assets/Scripts/PlayerController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b5fa9960655cb742880ef94db81ca9c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/Scripts/SlidingDoor.cs
Normal file
34
Assets/Scripts/SlidingDoor.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SlidingDoor : Triggerable
|
||||||
|
{
|
||||||
|
private Vector3 initialPos;
|
||||||
|
private bool isOpen = false;
|
||||||
|
[SerializeField]
|
||||||
|
private Transform openPos;
|
||||||
|
[SerializeField]
|
||||||
|
private float openSpeed;
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
initialPos = transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if(isOpen){
|
||||||
|
transform.position = Vector3.Lerp(transform.position, openPos.position, openSpeed*Time.deltaTime);
|
||||||
|
}else{
|
||||||
|
transform.position = Vector3.Lerp(transform.position, initialPos, openSpeed*Time.deltaTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void TriggerEvent(){
|
||||||
|
|
||||||
|
isOpen = !isOpen;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/SlidingDoor.cs.meta
Normal file
11
Assets/Scripts/SlidingDoor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 90c46c64cc336b6409943094eb9dedcf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
24
Assets/Scripts/Stunning.cs
Normal file
24
Assets/Scripts/Stunning.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Stunning : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private float duration;
|
||||||
|
[SerializeField]
|
||||||
|
private bool knockback = true;
|
||||||
|
[SerializeField]
|
||||||
|
private Vector2 stunDir;
|
||||||
|
|
||||||
|
|
||||||
|
private void OnCollisionEnter(Collision other) {
|
||||||
|
if(other.gameObject.tag.Equals("Player")){//Collided w/ player, stun him
|
||||||
|
PlayerController player = other.gameObject.GetComponent<PlayerController>();
|
||||||
|
player.Stun(duration);
|
||||||
|
if(knockback){
|
||||||
|
player.Knockback(stunDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Stunning.cs.meta
Normal file
11
Assets/Scripts/Stunning.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a94b6c0021fca74ba1778a83054fbe8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/Scripts/TriggerZone.cs
Normal file
34
Assets/Scripts/TriggerZone.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class TriggerZone : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private Triggerable linkedObj;
|
||||||
|
[SerializeField]
|
||||||
|
private bool onEnter = true, onStay = false, OnExit = false;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
private void OnTriggerEnter(Collider other) {
|
||||||
|
Debug.Log("Enter");
|
||||||
|
if(!onEnter)return;
|
||||||
|
if(other.gameObject.tag.Equals("Player")){
|
||||||
|
linkedObj.TriggerEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerStay(Collider other) {
|
||||||
|
if(!onStay)return;
|
||||||
|
if(other.gameObject.tag.Equals("Player")){
|
||||||
|
linkedObj.TriggerEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit(Collider other) {
|
||||||
|
Debug.Log("Exit");
|
||||||
|
if(!OnExit)return;
|
||||||
|
if(other.gameObject.tag.Equals("Player")){
|
||||||
|
linkedObj.TriggerEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/TriggerZone.cs.meta
Normal file
11
Assets/Scripts/TriggerZone.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 90baab3719135f24bb2f7611276bf3ab
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/Triggerable.cs
Normal file
8
Assets/Scripts/Triggerable.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public abstract class Triggerable : MonoBehaviour
|
||||||
|
{
|
||||||
|
public abstract void TriggerEvent();
|
||||||
|
}
|
||||||
11
Assets/Scripts/Triggerable.cs.meta
Normal file
11
Assets/Scripts/Triggerable.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ba0ea90a74032264499fca206d72ee56
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -12,7 +12,7 @@ TagManager:
|
|||||||
- Water
|
- Water
|
||||||
- UI
|
- UI
|
||||||
- Grappleable
|
- Grappleable
|
||||||
-
|
- Stun
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user