From e32e81531a3cecc1b2f53193123aef97c01edc4f Mon Sep 17 00:00:00 2001 From: Roman <1325980292@qq.com> Date: Tue, 14 Sep 2021 13:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BA=86SAIPOVersion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/Wave/Attack_Wave/AWM0.mat | 2 +- Assets/Scenes/序章-家中.unity | 168 +++++++++++++++--- Assets/Scenes/第一关.unity | 89 ++++------ Assets/Scripts/Shake.cs | 39 ++++ Assets/Scripts/Shake.cs.meta | 11 ++ Assets/Scripts/具象物体/MachineGunner.cs | 5 + UserSettings/EditorUserSettings.asset | 13 +- 7 files changed, 248 insertions(+), 79 deletions(-) create mode 100644 Assets/Scripts/Shake.cs create mode 100644 Assets/Scripts/Shake.cs.meta diff --git a/Assets/MyPostProcess/Effects/Wave/Attack_Wave/AWM0.mat b/Assets/MyPostProcess/Effects/Wave/Attack_Wave/AWM0.mat index f6838ad..c54a168 100644 --- a/Assets/MyPostProcess/Effects/Wave/Attack_Wave/AWM0.mat +++ b/Assets/MyPostProcess/Effects/Wave/Attack_Wave/AWM0.mat @@ -44,6 +44,6 @@ Material: - WaveIntensity_2: 1 - WaveSpread_Value: 0 m_Colors: - - Center: {r: 0.4706657, g: 0.43809277, b: 0, a: 0} + - Center: {r: 0.47573793, g: 0.37606302, b: 0, a: 0} - Vector2_d2d098295fc146f08b921b231b2e5199: {r: 1.6, g: 0.9, b: 0, a: 0} m_BuildTextureStacks: [] diff --git a/Assets/Scenes/序章-家中.unity b/Assets/Scenes/序章-家中.unity index e370263..b03cd53 100644 --- a/Assets/Scenes/序章-家中.unity +++ b/Assets/Scenes/序章-家中.unity @@ -531,6 +531,55 @@ Transform: m_Father: {fileID: 1860666399} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &74214783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 74214785} + - component: {fileID: 74214784} + m_Layer: 0 + m_Name: Parallax + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &74214784 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 74214783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 91489a29f6bc6c441a9bfb6aaeae25c5, type: 3} + m_Name: + m_EditorClassIdentifier: + backgrounds: + - {fileID: 204256633} + synZ: 0 + parallaxScaleX: 0.18 + parallaxScaleY: 1 + canParallax: 1 +--- !u!4 &74214785 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 74214783} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3.6393063, y: 1.3768971, z: -0.48157337} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &74982409 GameObject: m_ObjectHideFlags: 3 @@ -769,7 +818,6 @@ GameObject: m_Component: - component: {fileID: 204256633} - component: {fileID: 204256634} - - component: {fileID: 204256635} m_Layer: 0 m_Name: "\u8FDC\u5904" m_TagString: Untagged @@ -785,7 +833,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 204256632} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.78, y: 0, z: 27.08} + m_LocalPosition: {x: -3.39, y: 0, z: 6.67} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1856939521} @@ -842,20 +890,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!114 &204256635 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 204256632} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 69c08ecd162c9144b9de9ce144669c83, type: 3} - m_Name: - m_EditorClassIdentifier: - Cam: {fileID: 1861856990} - moveRate: 0.01 --- !u!1 &221401425 GameObject: m_ObjectHideFlags: 0 @@ -4291,6 +4325,9 @@ GameObject: - component: {fileID: 866289593} - component: {fileID: 866289592} - component: {fileID: 866289596} + - component: {fileID: 866289599} + - component: {fileID: 866289598} + - component: {fileID: 866289597} m_Layer: 0 m_Name: "\u4E0E\u7236\u4EB2\u5BF9\u8BDD" m_TagString: Untagged @@ -4313,7 +4350,7 @@ MonoBehaviour: nodeRect: serializedVersion: 2 x: 67 - y: 67 + y: 66 width: 122 height: 40 tint: {r: 1, g: 1, b: 1, a: 1} @@ -4330,6 +4367,9 @@ MonoBehaviour: - {fileID: 866289593} - {fileID: 866289592} - {fileID: 866289596} + - {fileID: 866289599} + - {fileID: 866289598} + - {fileID: 866289597} - {fileID: 866289591} suppressAllAutoSelections: 0 --- !u!114 &866289586 @@ -4345,10 +4385,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: version: 1 - scrollPos: {x: 32.5, y: 186} + scrollPos: {x: 32.5, y: 181} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 - blockViewHeight: 504 + blockViewHeight: 605 zoom: 1 scrollViewRect: serializedVersion: 2 @@ -4358,7 +4398,8 @@ MonoBehaviour: height: 859 selectedBlocks: - {fileID: 866289585} - selectedCommands: [] + selectedCommands: + - {fileID: 866289597} variables: [] description: stepPause: 0 @@ -4605,6 +4646,87 @@ MonoBehaviour: stopVoiceover: 1 waitForVO: 0 setSayDialog: {fileID: 582064879} +--- !u!114 &866289597 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866289584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 11 + indentLevel: 0 + storyText: "\u5BC6\u7801\u672C\u5728\u8FD9\u91CC\uFF0C\u6253\u4E00\u4E2A\u8BCD\u8BED\uFF0C\u201C\u4E2D\u56FD\u201D\uFF0C\u6765\u5C1D\u8BD5\u4E00\u4E0B\u5427\u3002" + description: + character: {fileID: 1851675996} + portrait: {fileID: 21300000, guid: 8bb7d99df9dd41b4c867ac425157c287, type: 3} + voiceOverClip: {fileID: 0} + showAlways: 1 + showCount: 1 + extendPrevious: 0 + fadeWhenDone: 1 + waitForClick: 1 + stopVoiceover: 1 + waitForVO: 0 + setSayDialog: {fileID: 582064879} +--- !u!114 &866289598 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866289584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 10 + indentLevel: 0 + storyText: "\u957F\u6309\u4EE3\u8868\u201C-\u201D\uFF0C\u4E5F\u5C31\u662F\u201C\u55D2\u201D\u3002" + description: + character: {fileID: 1851675996} + portrait: {fileID: 21300000, guid: 8bb7d99df9dd41b4c867ac425157c287, type: 3} + voiceOverClip: {fileID: 0} + showAlways: 1 + showCount: 1 + extendPrevious: 0 + fadeWhenDone: 1 + waitForClick: 1 + stopVoiceover: 1 + waitForVO: 0 + setSayDialog: {fileID: 582064879} +--- !u!114 &866289599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866289584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 9 + indentLevel: 0 + storyText: "\u64CD\u4F5C\u7535\u952E\uFF0C\u77ED\u6309\u4EE3\u8868\u201C\xB7\u201D\uFF0C\u4E5F\u5C31\u662F\u201C\u6EF4\u201D\u3002" + description: + character: {fileID: 1851675996} + portrait: {fileID: 21300000, guid: 8bb7d99df9dd41b4c867ac425157c287, type: 3} + voiceOverClip: {fileID: 0} + showAlways: 1 + showCount: 1 + extendPrevious: 0 + fadeWhenDone: 1 + waitForClick: 1 + stopVoiceover: 1 + waitForVO: 0 + setSayDialog: {fileID: 582064879} --- !u!1 &884155606 GameObject: m_ObjectHideFlags: 0 @@ -7168,7 +7290,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1384210878} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.06159973, y: 0.123600006, z: 0} + m_LocalPosition: {x: -0.06159973, y: 0.036, z: 0} m_LocalScale: {x: 1.5244006, y: 2.096748, z: 1} m_Children: [] m_Father: {fileID: 1170258148} @@ -7372,7 +7494,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 1366529690} + selectedFlowchart: {fileID: 866289586} --- !u!4 &1463945086 Transform: m_ObjectHideFlags: 1 @@ -9043,7 +9165,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1861856986} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -10.870555, y: -0.61863947, z: -10} + m_LocalPosition: {x: -10.870554, y: -0.61863995, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 716192431} diff --git a/Assets/Scenes/第一关.unity b/Assets/Scenes/第一关.unity index 73abdd5..5414b22 100644 --- a/Assets/Scenes/第一关.unity +++ b/Assets/Scenes/第一关.unity @@ -6643,7 +6643,7 @@ Transform: m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 12 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &186070682 GameObject: @@ -7603,7 +7603,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 367679635} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 202.5, y: -4.1, z: 0} + m_LocalPosition: {x: 282.9, y: -0.9, z: 0} m_LocalScale: {x: 0.39999998, y: 0.39999998, z: 0.39999998} m_Children: - {fileID: 1737112887496214201} @@ -22883,7 +22883,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1142437218} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -29.010345, y: -3.2993822, z: -10} + m_LocalPosition: {x: 45.63999, y: -2.0499995, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1608038909} @@ -24214,36 +24214,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &1305300353 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1305300354} - m_Layer: 0 - m_Name: GameObject - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1305300354 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1305300353} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 119.52, y: -6.79, z: -4.012952} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 9 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1329737168 GameObject: m_ObjectHideFlags: 0 @@ -24387,6 +24357,10 @@ PrefabInstance: propertyPath: heap value: objectReference: {fileID: 1099035901} + - target: {fileID: 8082445130133277896, guid: fab0acc13c79e5248a20877602bd9007, type: 3} + propertyPath: shake + value: + objectReference: {fileID: 1640419740} - target: {fileID: 8082445130133277896, guid: fab0acc13c79e5248a20877602bd9007, type: 3} propertyPath: stone value: @@ -25039,7 +25013,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1477400527} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -34.760002, y: -5.249999, z: -10} + m_LocalPosition: {x: 45.63999, y: -2.0499995, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 32565896} @@ -25217,7 +25191,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 11 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1505565869 PrefabInstance: @@ -25431,7 +25405,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1506236633 GameObject: @@ -31057,6 +31031,7 @@ GameObject: - component: {fileID: 1640419738} - component: {fileID: 1640419737} - component: {fileID: 1640419739} + - component: {fileID: 1640419740} m_Layer: 0 m_Name: "\u6321\u67AA\u77F3\u5806" m_TagString: Untagged @@ -31222,6 +31197,20 @@ PolygonCollider2D: - {x: -0.81, y: -1.56} - {x: -0.38, y: -1.7099999} - {x: -0.25, y: -1.68} +--- !u!114 &1640419740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640419736} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d80a3e3469191664c9c5dbaf68995cbf, type: 3} + m_Name: + m_EditorClassIdentifier: + shakeAmount: 0.05 + is_shake: 0 --- !u!1 &1648769683 GameObject: m_ObjectHideFlags: 0 @@ -44940,7 +44929,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 4936508675712544306} m_Bounds: - m_Center: {x: 0.0034165978, y: -0.0018951595, z: 0} + m_Center: {x: 0.0034242272, y: -0.0018942058, z: 0} m_Extent: {x: 0.68153024, y: 0.4230354, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -45025,7 +45014,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 5437654542896820717} m_Bounds: - m_Center: {x: 6.369995, y: -0.002114892, z: 0} + m_Center: {x: 6.369995, y: -0.0021139383, z: 0} m_Extent: {x: 0.855, y: 1.1198149, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -45108,7 +45097,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 2934879650646324577} m_Bounds: - m_Center: {x: 0.0007739663, y: -0.0022351146, z: 0} + m_Center: {x: 0.0007815957, y: -0.002234161, z: 0} m_Extent: {x: 0.6941651, y: 0.8818251, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -45293,7 +45282,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 7089406931308197820} m_Bounds: - m_Center: {x: -0.008480251, y: 0.000014662743, z: 0} + m_Center: {x: -0.008480251, y: 0.000012755394, z: 0} m_Extent: {x: 0.55653495, y: 0.69665515, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -45364,7 +45353,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 2360827735431813924} m_Bounds: - m_Center: {x: -0.0004426241, y: 0.00431484, z: 0} + m_Center: {x: -0.0004349947, y: 0.0043129325, z: 0} m_Extent: {x: 0.689565, y: 0.9506854, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -46097,7 +46086,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 4718247844144699107} m_Bounds: - m_Center: {x: 0.0019544363, y: 0, z: 0} + m_Center: {x: 0.0019544363, y: -0.0000009536743, z: 0} m_Extent: {x: 0.57801485, y: 0.9349998, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -46135,7 +46124,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 5215891186772959842} m_Bounds: - m_Center: {x: -0.000045895576, y: 0.0016950965, z: 0} + m_Center: {x: -0.000045895576, y: 0.0016946197, z: 0} m_Extent: {x: 1.1549999, y: 0.77910495, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47011,7 +47000,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 4586288761792830837} m_Bounds: - m_Center: {x: 0.0021419525, y: 0, z: 0} + m_Center: {x: 0.0021419525, y: -0.0000019073486, z: 0} m_Extent: {x: 0.60282004, y: 0.69500005, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47215,7 +47204,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 6675447233366868755} m_Bounds: - m_Center: {x: -0.00008839369, y: 0.00060486794, z: 0} + m_Center: {x: -0.00008839369, y: 0.0006058216, z: 0} m_Extent: {x: 0.705515, y: 1.2171149, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47306,7 +47295,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 7263140363742385229} m_Bounds: - m_Center: {x: -0.004308343, y: 0.0007251501, z: 0} + m_Center: {x: -0.0043007135, y: 0.00072419643, z: 0} m_Extent: {x: 0.8907454, y: 1.2819755, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47432,7 +47421,7 @@ MonoBehaviour: - {fileID: 8355431490900499643} - {fileID: 4936508675712544306} m_Bounds: - m_Center: {x: 0.0022922158, y: -0.0016773343, z: 0} + m_Center: {x: 0.0022998452, y: -0.0016763806, z: 0} m_Extent: {x: 0.68268514, y: 0.4232551, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47562,7 +47551,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 3397380986102525386} m_Bounds: - m_Center: {x: 0.0012915134, y: 0, z: 0} + m_Center: {x: 0.0012991428, y: 0, z: 0} m_Extent: {x: 0.7836551, y: 1.035, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47633,7 +47622,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 5215891186772959842} m_Bounds: - m_Center: {x: 0.002978921, y: -0.0026350021, z: 0} + m_Center: {x: 0.0029865503, y: -0.0026350021, z: 0} m_Extent: {x: 0.9919598, y: 1.2031548, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 @@ -47669,7 +47658,7 @@ MonoBehaviour: m_BoneTransforms: - {fileID: 8339351226288312874} m_Bounds: - m_Center: {x: 0.0016592741, y: -0.00012481213, z: 0} + m_Center: {x: 0.0016592741, y: -0.0001257658, z: 0} m_Extent: {x: 1.0732954, y: 1.2652456, z: 0} m_UseBatching: 1 m_AlwaysUpdate: 1 diff --git a/Assets/Scripts/Shake.cs b/Assets/Scripts/Shake.cs new file mode 100644 index 0000000..63622e2 --- /dev/null +++ b/Assets/Scripts/Shake.cs @@ -0,0 +1,39 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Shake : MonoBehaviour +{ + + + public float shakeAmount = 0.05f; //振幅 + public bool is_shake; + Vector3 first_pos; + + private void Start() + { + first_pos = this.transform.localPosition; + } + + public void StartShake() + { + //if (is_shake) return; + is_shake = true; + } + + public void Update() + { + if (!is_shake) return; + Vector3 pos = first_pos + Random.insideUnitSphere * shakeAmount; + pos.y = transform.localPosition.y; + transform.localPosition = pos; + } + + public void EndShake() + { + is_shake = false; + first_pos.y = transform.localPosition.y; + transform.localPosition = first_pos; + } + +} \ No newline at end of file diff --git a/Assets/Scripts/Shake.cs.meta b/Assets/Scripts/Shake.cs.meta new file mode 100644 index 0000000..20ea3e7 --- /dev/null +++ b/Assets/Scripts/Shake.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d80a3e3469191664c9c5dbaf68995cbf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/具象物体/MachineGunner.cs b/Assets/Scripts/具象物体/MachineGunner.cs index 3ca98f7..b785e6c 100644 --- a/Assets/Scripts/具象物体/MachineGunner.cs +++ b/Assets/Scripts/具象物体/MachineGunner.cs @@ -23,6 +23,8 @@ public class MachineGunner : MonoBehaviour [Tooltip("拖入老兵旁边的投掷物堆")] public BoxCollider2D heap; + public Shake shake; + void Start() { @@ -47,6 +49,7 @@ public class MachineGunner : MonoBehaviour //GetComponent().color = Color.red; //播放开火动画 gunnerAudio.Play(); + shake.is_shake = true; gunLight.isFire = true; person.SetBool("IsFiring",true); gun.SetBool("IsFiring",true); @@ -74,6 +77,7 @@ public class MachineGunner : MonoBehaviour { if(other.gameObject.tag == "投掷物") { + shake.is_shake = false;//控制石堆震动 gunLight.isFire = false; gunnerAudio.Stop();//关闭音效 hasBeHit = true;//标记自身已被击中 @@ -103,6 +107,7 @@ public class MachineGunner : MonoBehaviour public void BoomerHasBoom() { gunLight.isFire = false; + shake.is_shake = false;//控制石堆震动 gunnerAudio.Stop();//关闭音效 hasBeHit = true;//标记自身已被击中 //关闭开火动画 diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index d8973cd..e94d399 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -9,16 +9,19 @@ EditorUserSettings: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 RecentlyUsedScenePath-1: - value: 22424703114646680e0b0227036cdacaf990d3ea61ade8e6a9f1d07df7ee3d2cfb - flags: 0 - RecentlyUsedScenePath-2: value: 22424703114646680e0b0227036cdacaf990d3ea61aecec8a8d5c77df7ee3d2cfb flags: 0 + RecentlyUsedScenePath-2: + value: 22424703114646680e0b0227036cd8dcda93c2c6a9cdf57e38271427fb + flags: 0 RecentlyUsedScenePath-3: - value: 22424703114646680e0b0227036cd8dcda93c0caa9cdf57e38271427fb + value: 22424703114646680e0b0227036cdafade90ecf1aafdcdb8e2dc99eb0c69f6dc6a20dea7f234362820 flags: 0 RecentlyUsedScenePath-4: - value: 22424703114646680e0b0227036cd8dcda93c2c6a9cdf57e38271427fb + value: 22424703114646680e0b0227036cdacaf990d3ea61ade8e6a9f1d07df7ee3d2cfb + flags: 0 + RecentlyUsedScenePath-5: + value: 22424703114646680e0b0227036cd8dcda93c0caa9cdf57e38271427fb flags: 0 UnityEditor.ShaderGraph.Blackboard: value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4bae495d41895ac825e0100ec20313c0d91cddccd3d0c7efcca9bd898d91f0beb6fdd1cbfceba0b9f0b3bed8e8f5ace1ff8c978883d3f59e98969989eacfcc