cleaned up scripts a little bit

This commit is contained in:
slevy14 2023-04-17 16:47:12 -07:00
parent 275763628b
commit cb059613f9
7 changed files with 170 additions and 346 deletions

View File

@ -102,7 +102,7 @@ Material:
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.5 - _Glossiness: 0.5
- _GlossyReflections: 1 - _GlossyReflections: 1
- _LightingEnabled: 0 - _LightingEnabled: 1
- _Metallic: 0 - _Metallic: 0
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1

View File

@ -15,6 +15,7 @@ GameObject:
- component: {fileID: 5885597207104481990} - component: {fileID: 5885597207104481990}
- component: {fileID: 5885597207104481984} - component: {fileID: 5885597207104481984}
- component: {fileID: 1407172087} - component: {fileID: 1407172087}
- component: {fileID: 3893791749692807526}
- component: {fileID: 5559747613460074786} - component: {fileID: 5559747613460074786}
m_Layer: 2 m_Layer: 2
m_Name: Player m_Name: Player
@ -219,12 +220,59 @@ MonoBehaviour:
m_ControlsChangedEvent: m_ControlsChangedEvent:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_ActionEvents: [] m_ActionEvents:
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 5559747613460074786}
m_TargetAssemblyTypeName: PlayerMovement, Assembly-CSharp
m_MethodName: OnGrapple
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 183693a0-ab31-4f85-a4ef-b43b8a80fa77
m_ActionName: Player/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 2116b59e-20ee-4f7c-a656-aad81b0ae23a
m_ActionName: Player/Grapple[/Keyboard/l]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 00940c0e-3199-4943-a074-8cde87588db2
m_ActionName: Player/ThrowTambourine[/Keyboard/k]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 5a10231f-97fe-4bfb-89d8-4ac906d76de6
m_ActionName: Player/Jump[/Keyboard/space]
m_NeverAutoSwitchControlSchemes: 0 m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: m_DefaultControlScheme:
m_DefaultActionMap: Player m_DefaultActionMap: Player
m_SplitScreenIndex: -1 m_SplitScreenIndex: -1
m_Camera: {fileID: 0} m_Camera: {fileID: 0}
--- !u!114 &3893791749692807526
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5885597207104481991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0115312556794123a3cafad4b83d0a7, type: 3}
m_Name:
m_EditorClassIdentifier:
playerInput: {fileID: 1407172087}
launcher: {fileID: 6559806128767475056}
hasTambourine: 1
grapplingGun: {fileID: 3465910379319867675}
grapplingRope: {fileID: 7648135587659148198}
playerController: {fileID: 5559747613460074786}
stateController: {fileID: 0}
--- !u!114 &5559747613460074786 --- !u!114 &5559747613460074786
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -247,8 +295,6 @@ MonoBehaviour:
m_Bits: 64 m_Bits: 64
boxSize: {x: 0.03, y: 0.21} boxSize: {x: 0.03, y: 0.21}
maxDistanceFromGround: 0.13 maxDistanceFromGround: 0.13
grapplingGun: {fileID: 3465910379319867675}
grapplingRope: {fileID: 7648135587659148198}
stateController: {fileID: 0} stateController: {fileID: 0}
--- !u!1 &5885597207531562995 --- !u!1 &5885597207531562995
GameObject: GameObject:
@ -357,7 +403,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 1
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 0.64606833, g: 1, b: 0, a: 1} m_Color: {r: 0.64606833, g: 1, b: 0, a: 1}
m_FlipX: 0 m_FlipX: 0
@ -528,7 +574,7 @@ LineRenderer:
- {x: 0, y: 0, z: 1} - {x: 0, y: 0, z: 1}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 0.15 widthMultiplier: 0.1
widthCurve: widthCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -593,7 +639,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5885597207789090697} m_GameObject: {fileID: 5885597207789090697}
m_BodyType: 0 m_BodyType: 1
m_Simulated: 1 m_Simulated: 1
m_UseFullKinematicContacts: 0 m_UseFullKinematicContacts: 0
m_UseAutoMass: 0 m_UseAutoMass: 0
@ -686,7 +732,7 @@ MonoBehaviour:
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 1 time: 1
value: 0.0012016296 value: 0
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 0 tangentMode: 0
@ -696,7 +742,7 @@ MonoBehaviour:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
startWaveSize: 2 startWaveSize: 4
ropeProgressionCurve: ropeProgressionCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:

View File

@ -188,17 +188,6 @@ MonoBehaviour:
player: {fileID: 5885597207104481991, guid: 576d3fc87874f426294e4bbacb171478, type: 3} player: {fileID: 5885597207104481991, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
spawnPoint: {fileID: 1159415542} spawnPoint: {fileID: 1159415542}
deathCanvas: {fileID: 880696833} deathCanvas: {fileID: 880696833}
--- !u!114 &129360812 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3465910379319867675, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6e8c21a2613bf4423a2f49601a3310e3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &193907867 --- !u!1 &193907867
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1364,7 +1353,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028} m_GameObject: {fileID: 519420028}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -25.56, y: -10.43, z: -10} m_LocalPosition: {x: -24.31, y: -10.73, z: -10}
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: []
@ -2325,82 +2314,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_NotificationBehavior
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.size
value: 4
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_ActionId
value: 183693a0-ab31-4f85-a4ef-b43b8a80fa77
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[1].m_ActionId
value: 2116b59e-20ee-4f7c-a656-aad81b0ae23a
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[2].m_ActionId
value: 00940c0e-3199-4943-a074-8cde87588db2
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[3].m_ActionId
value: 5a10231f-97fe-4bfb-89d8-4ac906d76de6
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_ActionName
value: Player/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d]
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[1].m_ActionName
value: Player/Grapple[/Keyboard/l]
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[2].m_ActionName
value: Player/ThrowTambourine[/Keyboard/k]
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[3].m_ActionName
value: Player/Jump[/Keyboard/space]
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 1787574353}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnGrapple
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: PlayerMovement, Assembly-CSharp
objectReference: {fileID: 0}
- target: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ActionEvents.Array.data[0].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 3465910379319867675, guid: 576d3fc87874f426294e4bbacb171478, type: 3} - target: {fileID: 3465910379319867675, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_camera propertyPath: m_camera
value: value:
objectReference: {fileID: 519420031} objectReference: {fileID: 519420031}
- target: {fileID: 5559747613460074786, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: launcher
value:
objectReference: {fileID: 2001713740}
- target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3} - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 13 value: 13
@ -2452,10 +2369,7 @@ PrefabInstance:
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: m_AddedComponents: []
- targetCorrespondingSourceObject: {fileID: 5885597207104481991, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
insertIndex: 7
addedObject: {fileID: 1787574362}
m_SourcePrefab: {fileID: 100100000, guid: 576d3fc87874f426294e4bbacb171478, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
--- !u!1 &1411598161 --- !u!1 &1411598161
GameObject: GameObject:
@ -3259,60 +3173,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767983939} m_GameObject: {fileID: 1767983939}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1787574352 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5885597207104481991, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1787574353 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5559747613460074786, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1787574352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7b873819f9a3f36ef898a0403972da28, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1787574354 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1407172087, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1787574352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1787574362
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1787574352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0115312556794123a3cafad4b83d0a7, type: 3}
m_Name:
m_EditorClassIdentifier:
moveSpeed: 0
jumpSpeed: 0
airSpeed: 0
playerInput: {fileID: 1787574354}
groundLayer:
serializedVersion: 2
m_Bits: 64
boxSize: {x: 0, y: 0}
maxDistanceFromGround: 0
launcher: {fileID: 2001713740}
hasTambourine: 1
grapplingGun: {fileID: 129360812}
grapplingRope: {fileID: 2119213706}
playerController: {fileID: 1787574353}
stateController: {fileID: 0}
--- !u!1 &1796403731 --- !u!1 &1796403731
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -10177,43 +10037,79 @@ CompositeCollider2D:
Y: -63125000 Y: -63125000
m_CompositePaths: m_CompositePaths:
m_Paths: m_Paths:
- - {x: 21, y: -18.882843} - - {x: 21, y: -11}
- {x: 21, y: -11.117158} - {x: -19, y: -11}
- {x: 20.882843, y: -11} - {x: -19, y: -17}
- {x: -18.882843, y: -11} - {x: -28, y: -17}
- {x: -19, y: -11.117158} - {x: -28, y: -11}
- {x: -19, y: -16.882843} - {x: -37, y: -11}
- {x: -19.117157, y: -17} - {x: -37, y: 11}
- {x: -27.882841, y: -17} - {x: -38, y: 11}
- {x: -28, y: -16.882843} - {x: -38, y: -19}
- {x: -28, y: -11.117158} - {x: 21, y: -19}
- {x: -28.117159, y: -11} - - {x: -25, y: -6.25}
- {x: -36.882843, y: -11} - {x: -24.8125, y: -6.3125}
- {x: -37, y: -10.882842} - {x: -24.09375, y: -6.3125}
- {x: -37, y: 10.882842} - {x: -24, y: -6.25}
- {x: -37.117157, y: 11} - {x: -23.8125, y: -6.3125}
- {x: -38, y: 10.882842} - {x: -23.09375, y: -6.3125}
- {x: -38, y: -18.882843} - {x: -23, y: -6.25}
- {x: -37.882843, y: -19} - {x: -22.8125, y: -6.3125}
- {x: 20.882843, y: -19} - {x: -22.09375, y: -6.3125}
- - {x: -21.117157, y: -6.25} - {x: -22, y: -6.25}
- {x: -20.882843, y: -6} - {x: -21.8125, y: -6.3125}
- {x: 8.882842, y: -6} - {x: -21.09375, y: -6.3125}
- {x: 9, y: -5.882843} - {x: -21, y: -6.25}
- {x: 9, y: -1.8268197} - {x: -21, y: -6}
- {x: 2.2543635, y: -4.018818} - {x: 9, y: -6}
- {x: 0.5492318, y: -4.3823714} - {x: 9, y: -1.6875}
- {x: -0.1171574, y: -5} - {x: 8.75, y: -1.6875}
- {x: -8.882842, y: -5} - {x: 8.343751, y: -1.78125}
- {x: -9.117158, y: -3} - {x: 8.343751, y: -2}
- {x: -34.882843, y: -3} - {x: 8.0625, y: -2}
- {x: -35, y: -3.1171572} - {x: 8, y: -2.0625}
- {x: -35, y: -5.882843} - {x: 8, y: -2.09375}
- {x: -34.882843, y: -6} - {x: 7.375, y: -2.09375}
- {x: -26.117157, y: -6} - {x: 7, y: -2.3125}
- {x: -25.882843, y: -6.25} - {x: 7, y: -2.34375}
- {x: 6.9687505, y: -2.34375}
- {x: 6.5625, y: -2.375}
- {x: 6, y: -2.6875}
- {x: 5.75, y: -2.6875}
- {x: 5.34375, y: -2.78125}
- {x: 5.34375, y: -3}
- {x: 5.0625, y: -3}
- {x: 5, y: -3.0625}
- {x: 5, y: -3.09375}
- {x: 4.375, y: -3.09375}
- {x: 4, y: -3.3125}
- {x: 4, y: -3.34375}
- {x: 3.96875, y: -3.34375}
- {x: 3.5625, y: -3.375}
- {x: 3, y: -3.6875}
- {x: 2.75, y: -3.6875}
- {x: 2.34375, y: -3.78125}
- {x: 2.34375, y: -4}
- {x: 2.0625, y: -4}
- {x: 2, y: -4.0625}
- {x: 2, y: -4.09375}
- {x: 1.375, y: -4.09375}
- {x: 1, y: -4.3125}
- {x: 1, y: -4.34375}
- {x: 0.96875, y: -4.34375}
- {x: 0.5625, y: -4.375}
- {x: 0, y: -4.6875}
- {x: 0, y: -5}
- {x: -9, y: -5}
- {x: -9, y: -3}
- {x: -35, y: -3}
- {x: -35, y: -6}
- {x: -26, y: -6}
- {x: -26, y: -6.25}
- {x: -25.8125, y: -6.3125}
- {x: -25.09375, y: -6.3125}
m_VertexDistance: 0.11 m_VertexDistance: 0.11
m_OffsetDistance: 0.2 m_OffsetDistance: 0
m_UseDelaunayMesh: 1 m_UseDelaunayMesh: 1
m_CompositeGameObject: {fileID: 1818375521} m_CompositeGameObject: {fileID: 1818375521}
--- !u!50 &1818375527 --- !u!50 &1818375527
@ -10585,17 +10481,6 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 16 m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2001713740 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6559806128767475056, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b49ff353512cc43728014da636fce388, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2026489080 --- !u!1 &2026489080
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -10708,14 +10593,3 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5e69412b9141e4bdeaaaf00f6dce7b82, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 5e69412b9141e4bdeaaaf00f6dce7b82, type: 3}
--- !u!114 &2119213706 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7648135587659148198, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
m_PrefabInstance: {fileID: 1407172085}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 06317215013e44d0fb7902fbc1c5e84e, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -7,18 +7,11 @@ public class PlayerBehavior : MonoBehaviour
{ {
[Header("Physics:")] [Header("Physics:")]
public float moveSpeed;
public float jumpSpeed;
public float airSpeed;
private float _hInput; private float _hInput;
private Rigidbody2D _rb; private Rigidbody2D _rb;
private int forward = 1; private int forward = 1;
public PlayerInput playerInput; public PlayerInput playerInput;
public LayerMask groundLayer;
public Vector2 boxSize;
public float maxDistanceFromGround;
[Header("Tambourine:")] [Header("Tambourine:")]
[SerializeField] private Launch launcher; [SerializeField] private Launch launcher;
[HideInInspector] public bool hasTambourine = true; [HideInInspector] public bool hasTambourine = true;
@ -37,7 +30,6 @@ public class PlayerBehavior : MonoBehaviour
void Start() void Start()
{ {
_rb = GetComponent<Rigidbody2D>(); _rb = GetComponent<Rigidbody2D>();
airSpeed = .5f * moveSpeed;
stateController = GameObject.Find("StateController").GetComponent<StateController>(); stateController = GameObject.Find("StateController").GetComponent<StateController>();
} }
@ -112,4 +104,25 @@ public class PlayerBehavior : MonoBehaviour
} }
grapplingGun.ReleaseGrapple(); grapplingGun.ReleaseGrapple();
} }
void OnTriggerEnter2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = col.gameObject;
}
else if (col.tag == "instaDeath")
{
this.stateController.SetDeathCanvasActive(true);
Destroy(this.gameObject);
}
}
void OnTriggerExit2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = null;
}
}
} }

View File

@ -23,18 +23,11 @@ public class PlayerMovement : MonoBehaviour
public Vector2 boxSize; public Vector2 boxSize;
public float maxDistanceFromGround; public float maxDistanceFromGround;
[Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
[SerializeField] public Tutorial_GrapplingRope grapplingRope;
private GameObject grappleSurface;
[Header("Tambourine:")]
[SerializeField] private Launch launcher;
[HideInInspector] public bool hasTambourine = true;
[Header("State Control:")] [Header("State Control:")]
[SerializeField] private StateController stateController; [SerializeField] private StateController stateController;
PlayerBehavior playerBehavior;
void OnValidate() void OnValidate()
{ {
this.runAcceleration = Mathf.Clamp(runAcceleration, 0.1f, this.maxRunSpeed); this.runAcceleration = Mathf.Clamp(runAcceleration, 0.1f, this.maxRunSpeed);
@ -42,6 +35,7 @@ public class PlayerMovement : MonoBehaviour
void Start() void Start()
{ {
playerBehavior = this.gameObject.GetComponent<PlayerBehavior>();
this.rb = this.GetComponent<Rigidbody2D>(); this.rb = this.GetComponent<Rigidbody2D>();
stateController = GameObject.Find("StateController").GetComponent<StateController>(); stateController = GameObject.Find("StateController").GetComponent<StateController>();
} }
@ -88,14 +82,16 @@ public class PlayerMovement : MonoBehaviour
float frictionAmount = 0.5f; float frictionAmount = 0.5f;
// accelerate // accelerate
if (onGround && (Mathf.Abs(this.movement.x) > 0.1f)) { if (onGround && (Mathf.Abs(this.movement.x) > 0.1f)) { // regular acceleration
this.rb.AddForce(move * Vector2.right, ForceMode2D.Force); this.rb.AddForce(move * Vector2.right, ForceMode2D.Force);
} else if (!onGround && (Mathf.Abs(this.movement.x) > 0.1f)) { } else if (!onGround && (Mathf.Abs(this.movement.x) > 0.1f) && !playerBehavior.grapplingRope.isGrappling) { // while in air
this.rb.AddForce(move * Vector2.right * airSpeedMultiplier, ForceMode2D.Force); this.rb.AddForce(move * Vector2.right * airSpeedMultiplier, ForceMode2D.Force);
} else if (!playerBehavior.grapplingRope.isGrappling) { // while grappling
this.rb.AddForce(move * Vector2.right * airSpeedMultiplier * airSpeedMultiplier, ForceMode2D.Force);
} }
// decelerate until stopped // decelerate until stopped
if (Mathf.Abs(this.movement.x) < 0.1f) if (onGround && Mathf.Abs(this.movement.x) < 0.1f)
{ {
if (Mathf.Abs(rb.velocity.x) > 0.1f) { if (Mathf.Abs(rb.velocity.x) > 0.1f) {
float amount = Mathf.Min( float amount = Mathf.Min(
@ -110,27 +106,6 @@ public class PlayerMovement : MonoBehaviour
} }
} }
void OnTriggerEnter2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = col.gameObject;
}
else if (col.tag == "instaDeath")
{
this.stateController.SetDeathCanvasActive(true);
Destroy(this.gameObject);
}
}
void OnTriggerExit2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = null;
}
}
bool IsGrounded() bool IsGrounded()
{ {
if (Physics2D.BoxCast(transform.position, boxSize, 0, -transform.up, maxDistanceFromGround, groundLayer)) if (Physics2D.BoxCast(transform.position, boxSize, 0, -transform.up, maxDistanceFromGround, groundLayer))

View File

@ -25,22 +25,12 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
[SerializeField] private bool rotateOverTime = true; [SerializeField] private bool rotateOverTime = true;
[Range(0, 60)][SerializeField] private float rotationSpeed = 4; [Range(0, 60)][SerializeField] private float rotationSpeed = 4;
[Header("Distance:")]
[SerializeField] private bool hasMaxDistance = false;
[SerializeField] private float maxDistance = 20;
private enum LaunchType { private enum LaunchType {
TransformLaunch, TransformLaunch,
PhysicsLaunch PhysicsLaunch
} }
[Header("Launching:")]
[SerializeField] private bool launchToPoint = true;
[SerializeField] private LaunchType launchType = LaunchType.PhysicsLaunch;
[SerializeField] private float launchSpeed = 1;
[Header("No Launch To Point")] [Header("No Launch To Point")]
[SerializeField] private bool autoConfigureDistance = false;
[SerializeField] private float targetDistance = 3; [SerializeField] private float targetDistance = 3;
[SerializeField] private float targetFrequency = 1; [SerializeField] private float targetFrequency = 1;
@ -60,32 +50,12 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
} }
void Update() { void Update() {
// if (Input.GetKeyDown(KeyCode.Mouse0)) {
// SetGrapplePoint();
// } else if (Input.GetKey(KeyCode.Mouse0)) {
// if (grappleRope.enabled) {
// RotateGun(grapplePoint, false);
// } else {
// Vector2 mousePos = m_camera.ScreenToWorldPoint(Input.mousePosition);
// RotateGun(mousePos, true);
// }
// if (launchToPoint && grappleRope.isGrappling) { Vector2 mousePos = m_camera.ScreenToWorldPoint(Mouse.current.position.ReadValue());
// if (launchType == LaunchType.TransformLaunch) { RotateGun(mousePos, true);
// Vector2 firePointDistance = firePoint.position - gunHolder.localPosition;
// Vector2 targetPos = grapplePoint - firePointDistance;
// gunHolder.position = Vector2.Lerp(gunHolder.position, targetPos, Time.deltaTime * launchSpeed);
// }
// }
// } else if (Input.GetKeyUp(KeyCode.Mouse0)) {
// ReleaseGrapple();
// } else {
Vector2 mousePos = m_camera.ScreenToWorldPoint(Mouse.current.position.ReadValue());
RotateGun(mousePos, true);
// }
if (grappleRope.isGrappling && !inDistanceRange && Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) < targetDistance) { if (grappleRope.isGrappling && !inDistanceRange && Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) < targetDistance) {
print(Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) + ", target: " + targetDistance); // print(Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) + ", target: " + targetDistance);
inDistanceRange = true; inDistanceRange = true;
} }
if (inDistanceRange) { if (inDistanceRange) {
@ -105,65 +75,17 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
} }
// void SetGrapplePoint() {
// Vector2 distanceVector = m_camera.ScreenToWorldPoint(Input.mousePosition) - gunPivot.position;
// // print("clicked" + m_camera.ScreenToWorldPoint(Input.mousePosition));
// // print("distance vector: " + distanceVector);
// if (Physics2D.Raycast(firePoint.position, distanceVector.normalized)) {
// RaycastHit2D _hit = Physics2D.Raycast(firePoint.position, distanceVector.normalized);
// print(_hit.transform.gameObject.name);
// if (_hit.transform.gameObject.layer == grappleLayerNumber || grappleToAll) {
// if (Vector2.Distance(_hit.point, firePoint.position) <= maxDistance || !hasMaxDistance) {
// // print("gunPivot " + gunPivot.position + ", grappling to: " + _hit.point);
// grapplePoint = _hit.point;
// grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position;
// grappleRope.enabled = true;
// }
// }
// }
// }
public void Grapple() { public void Grapple() {
print("grapple"); // print("grapple");
m_springJoint2D.autoConfigureDistance = false; m_springJoint2D.autoConfigureDistance = false;
m_distanceJoint2D.autoConfigureDistance = false; m_distanceJoint2D.autoConfigureDistance = false;
if(!launchToPoint && !autoConfigureDistance) { m_springJoint2D.connectedAnchor = grapplePoint;
m_springJoint2D.distance = targetDistance; m_springJoint2D.enabled = true;
print("Sprint Joint Distance:" + m_springJoint2D.distance); // print("Spring Joint Enabled");
m_springJoint2D.frequency = targetFrequency; // print("Sprint Joint Distance:" + m_springJoint2D.distance);
}
if (!launchToPoint) {
if (autoConfigureDistance) {
m_springJoint2D.connectedAnchor = grapplePoint;
m_springJoint2D.enabled = true;
// print("Spring Joint Enabled");
print("Sprint Joint Distance:" + m_springJoint2D.distance);
m_distanceJoint2D.connectedAnchor = grapplePoint; m_distanceJoint2D.connectedAnchor = grapplePoint;
}
} else {
switch (launchType) {
case LaunchType.PhysicsLaunch:
m_springJoint2D.connectedAnchor = grapplePoint;
m_distanceJoint2D.connectedAnchor = grapplePoint;
Vector2 distanceVector = firePoint.position - gunHolder.position;
m_springJoint2D.distance = distanceVector.magnitude;
m_springJoint2D.frequency = launchSpeed;
m_springJoint2D.enabled = true;
// m_distanceJoint2D.maxDistanceOnly = false;
m_distanceJoint2D.distance = targetDistance + .5f;
break;
case LaunchType.TransformLaunch:
m_rigidBody2D.gravityScale = 0;
m_rigidBody2D.velocity = Vector2.zero;
break;
}
}
} }
public void GrappleToTambourine(GameObject tambourine) { public void GrappleToTambourine(GameObject tambourine) {
@ -209,11 +131,4 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
// print("disabled"); // print("disabled");
} }
private void OnDrawGizmosSelected() {
if (firePoint != null && hasMaxDistance) {
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(firePoint.position, maxDistance);
}
}
} }

View File

@ -62,7 +62,7 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
if (!straightLine) { if (!straightLine) {
float roundedLinePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 10.0f) * .01f; float roundedLinePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 10.0f) * .01f;
float roundedGrapplePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 10.0f) * .01f; float roundedGrapplePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 10.0f) * .01f;
print(roundedLinePos + " / " + roundedGrapplePos); // print(roundedLinePos + " / " + roundedGrapplePos);
if (roundedLinePos == roundedGrapplePos) { if (roundedLinePos == roundedGrapplePos) {
straightLine = true; straightLine = true;
} else { } else {
@ -87,6 +87,7 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
} }
void DrawRopeWaves() { void DrawRopeWaves() {
print(moveTime);
for (int i = 0; i < precision; i++) { for (int i = 0; i < precision; i++) {
float delta = (float)i / ((float)precision - 1f); float delta = (float)i / ((float)precision - 1f);
Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize; Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize;