diff --git a/Assets/Fungus/Integrations/Playmaker/Fungus-PlayMaker.unitypackage.meta b/Assets/Fungus/Integrations/Playmaker/Fungus-PlayMaker.unitypackage.meta new file mode 100644 index 0000000..e474937 --- /dev/null +++ b/Assets/Fungus/Integrations/Playmaker/Fungus-PlayMaker.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 81dbcde0f90df4e9ba9ca2794490e57a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/Integrations/Spine/Fungus-Spine.unitypackage.meta b/Assets/Fungus/Integrations/Spine/Fungus-Spine.unitypackage.meta new file mode 100644 index 0000000..eebd079 --- /dev/null +++ b/Assets/Fungus/Integrations/Spine/Fungus-Spine.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fd02c799f3f5c4c83b2fc26c105a3821 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/InputAssets/Player.cs b/Assets/InputAssets/Player.cs index f911c85..f4e2396 100644 --- a/Assets/InputAssets/Player.cs +++ b/Assets/InputAssets/Player.cs @@ -41,6 +41,14 @@ public class @Player : IInputActionCollection, IDisposable ""expectedControlType"": ""Button"", ""processors"": """", ""interactions"": """" + }, + { + ""name"": ""Sickle"", + ""type"": ""Button"", + ""id"": ""d92eaf00-7eaf-4292-ae80-6bfff20b5930"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" } ], ""bindings"": [ @@ -153,6 +161,28 @@ public class @Player : IInputActionCollection, IDisposable ""action"": ""Wave"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e091c2cb-5d64-4c6c-80a8-2c5b3a3e03df"", + ""path"": ""/u"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Sickle"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e9e35d09-e599-40ed-b8e5-ab03961ca484"", + ""path"": ""/rightTrigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Sickle"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -181,6 +211,7 @@ public class @Player : IInputActionCollection, IDisposable m_Normal_Move = m_Normal.FindAction("Move", throwIfNotFound: true); m_Normal_Jump = m_Normal.FindAction("Jump", throwIfNotFound: true); m_Normal_Wave = m_Normal.FindAction("Wave", throwIfNotFound: true); + m_Normal_Sickle = m_Normal.FindAction("Sickle", throwIfNotFound: true); } public void Dispose() @@ -233,6 +264,7 @@ public class @Player : IInputActionCollection, IDisposable private readonly InputAction m_Normal_Move; private readonly InputAction m_Normal_Jump; private readonly InputAction m_Normal_Wave; + private readonly InputAction m_Normal_Sickle; public struct NormalActions { private @Player m_Wrapper; @@ -240,6 +272,7 @@ public class @Player : IInputActionCollection, IDisposable public InputAction @Move => m_Wrapper.m_Normal_Move; public InputAction @Jump => m_Wrapper.m_Normal_Jump; public InputAction @Wave => m_Wrapper.m_Normal_Wave; + public InputAction @Sickle => m_Wrapper.m_Normal_Sickle; public InputActionMap Get() { return m_Wrapper.m_Normal; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -258,6 +291,9 @@ public class @Player : IInputActionCollection, IDisposable @Wave.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnWave; @Wave.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnWave; @Wave.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnWave; + @Sickle.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle; + @Sickle.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle; + @Sickle.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle; } m_Wrapper.m_NormalActionsCallbackInterface = instance; if (instance != null) @@ -271,6 +307,9 @@ public class @Player : IInputActionCollection, IDisposable @Wave.started += instance.OnWave; @Wave.performed += instance.OnWave; @Wave.canceled += instance.OnWave; + @Sickle.started += instance.OnSickle; + @Sickle.performed += instance.OnSickle; + @Sickle.canceled += instance.OnSickle; } } } @@ -289,5 +328,6 @@ public class @Player : IInputActionCollection, IDisposable void OnMove(InputAction.CallbackContext context); void OnJump(InputAction.CallbackContext context); void OnWave(InputAction.CallbackContext context); + void OnSickle(InputAction.CallbackContext context); } } diff --git a/Assets/InputAssets/Player.inputactions b/Assets/InputAssets/Player.inputactions index 44f2267..2104cfd 100644 --- a/Assets/InputAssets/Player.inputactions +++ b/Assets/InputAssets/Player.inputactions @@ -28,6 +28,14 @@ "expectedControlType": "Button", "processors": "", "interactions": "" + }, + { + "name": "Sickle", + "type": "Button", + "id": "d92eaf00-7eaf-4292-ae80-6bfff20b5930", + "expectedControlType": "Button", + "processors": "", + "interactions": "" } ], "bindings": [ @@ -140,6 +148,28 @@ "action": "Wave", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "e091c2cb-5d64-4c6c-80a8-2c5b3a3e03df", + "path": "/u", + "interactions": "", + "processors": "", + "groups": "", + "action": "Sickle", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "e9e35d09-e599-40ed-b8e5-ab03961ca484", + "path": "/rightTrigger", + "interactions": "", + "processors": "", + "groups": "", + "action": "Sickle", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/MySQL/GetSQL.cs b/Assets/MySQL/GetSQL.cs index 00040f2..08258dc 100644 --- a/Assets/MySQL/GetSQL.cs +++ b/Assets/MySQL/GetSQL.cs @@ -34,6 +34,7 @@ public class GetSQL : MonoBehaviour } catch (MySqlException e) { + e.ToString();//解决Warming Debug.Log("连接失败"); } diff --git a/Assets/Plugins/Sirenix/Demos/Custom Attribute Processors.unitypackage.meta b/Assets/Plugins/Sirenix/Demos/Custom Attribute Processors.unitypackage.meta new file mode 100644 index 0000000..1eadf09 --- /dev/null +++ b/Assets/Plugins/Sirenix/Demos/Custom Attribute Processors.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f597f19f656ba56eae4f6a3a7cc528f4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Demos/Custom Drawers.unitypackage.meta b/Assets/Plugins/Sirenix/Demos/Custom Drawers.unitypackage.meta new file mode 100644 index 0000000..f073d2a --- /dev/null +++ b/Assets/Plugins/Sirenix/Demos/Custom Drawers.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 48e08dc33330d11e9d4a1b246c52e4f6 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Demos/Editor Windows.unitypackage.meta b/Assets/Plugins/Sirenix/Demos/Editor Windows.unitypackage.meta new file mode 100644 index 0000000..130722a --- /dev/null +++ b/Assets/Plugins/Sirenix/Demos/Editor Windows.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ed09910c0094cb27be8f3ca264680da3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Demos/Sample - RPG Editor.unitypackage.meta b/Assets/Plugins/Sirenix/Demos/Sample - RPG Editor.unitypackage.meta new file mode 100644 index 0000000..f9b8ed8 --- /dev/null +++ b/Assets/Plugins/Sirenix/Demos/Sample - RPG Editor.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cc355dd4cf1e6173beaeb22c2858cbe1 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/镰刀.prefab b/Assets/Prefabs/镰刀.prefab new file mode 100644 index 0000000..b76432c --- /dev/null +++ b/Assets/Prefabs/镰刀.prefab @@ -0,0 +1,232 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8280362330273855463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8280362330273855458} + - component: {fileID: 8280362330273855457} + - component: {fileID: 8280362330273855456} + - component: {fileID: 8280362330273855459} + - component: {fileID: 4580081233370270625} + m_Layer: 0 + m_Name: "\u9570\u5200" + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8280362330273855458 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8280362330273855463} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.356, y: 1.079, z: 0} + m_LocalScale: {x: 0.3, y: 0.3, z: 0.3} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &8280362330273855457 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8280362330273855463} + 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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &8280362330273855456 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8280362330273855463} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4d0390bd8b8ffd640b34fe25065ff1df, type: 3} + m_Name: + m_EditorClassIdentifier: + updateType: 0 + isSpeedBased: 0 + hasOnStart: 0 + hasOnPlay: 0 + hasOnUpdate: 0 + hasOnStepComplete: 0 + hasOnComplete: 0 + hasOnTweenCreated: 0 + hasOnRewind: 0 + onStart: + m_PersistentCalls: + m_Calls: [] + onPlay: + m_PersistentCalls: + m_Calls: [] + onUpdate: + m_PersistentCalls: + m_Calls: [] + onStepComplete: + m_PersistentCalls: + m_Calls: [] + onComplete: + m_PersistentCalls: + m_Calls: [] + onTweenCreated: + m_PersistentCalls: + m_Calls: [] + onRewind: + m_PersistentCalls: + m_Calls: [] + targetIsSelf: 1 + targetGO: {fileID: 0} + tweenTargetIsTargetGO: 1 + delay: 0 + duration: 0.15 + easeType: 1 + easeCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + loopType: 0 + loops: -1 + id: + isRelative: 0 + isFrom: 0 + isIndependentUpdate: 0 + autoKill: 0 + isActive: 1 + isValid: 1 + target: {fileID: 8280362330273855458} + animationType: 4 + targetType: 11 + forcedTargetType: 0 + autoPlay: 1 + useTargetAsV3: 0 + endValueFloat: 0 + endValueV3: {x: 0, y: 0, z: -90} + endValueV2: {x: 0, y: 0} + endValueColor: {r: 1, g: 1, b: 1, a: 1} + endValueString: + endValueRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + endValueTransform: {fileID: 0} + optionalBool0: 0 + optionalFloat0: 0 + optionalInt0: 0 + optionalRotationMode: 0 + optionalScrambleMode: 0 + optionalString: +--- !u!114 &8280362330273855459 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8280362330273855463} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee06f8347188d8649aa054cb692bb497, type: 3} + m_Name: + m_EditorClassIdentifier: + dir: 0 + speed: 10 +--- !u!61 &4580081233370270625 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8280362330273855463} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 diff --git a/Assets/Prefabs/镰刀.prefab.meta b/Assets/Prefabs/镰刀.prefab.meta new file mode 100644 index 0000000..a395b02 --- /dev/null +++ b/Assets/Prefabs/镰刀.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2e2fb120ae20d5e4faaad5a2a2fcca30 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/test.unity b/Assets/Scenes/test.unity index 1e54eaf..53c0040 100644 --- a/Assets/Scenes/test.unity +++ b/Assets/Scenes/test.unity @@ -123,6 +123,115 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &86920434 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 86920435} + - component: {fileID: 86920437} + - component: {fileID: 86920436} + m_Layer: 0 + m_Name: "\u9570\u5200\u98DE\u51FA\u6D88\u9664\u89E6\u53D1\u5668\u53F3" + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &86920435 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86920434} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10.28, y: 1.47, z: 0} + m_LocalScale: {x: 1, y: 16.891874, z: 1} + m_Children: [] + m_Father: {fileID: 326335323} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &86920436 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86920434} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!212 &86920437 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86920434} + 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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &321454205 GameObject: m_ObjectHideFlags: 0 @@ -356,6 +465,9 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 321454206} + - {fileID: 839378815} + - {fileID: 971340855} + - {fileID: 86920435} m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -479,6 +591,22 @@ MonoBehaviour: m_CallState: 2 m_ActionId: a8c8071a-3441-4efd-919d-6bf31d7c6e65 m_ActionName: Normal/Wave[/XInputControllerWindows/buttonWest,/Keyboard/j] + - m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 326335327} + m_TargetAssemblyTypeName: MyPlayer, Assembly-CSharp + m_MethodName: OnSickle + 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: d92eaf00-7eaf-4292-ae80-6bfff20b5930 + m_ActionName: Normal/Sickle[/Keyboard/u,/XInputControllerWindows/rightTrigger] m_NeverAutoSwitchControlSchemes: 0 m_DefaultControlScheme: Play m_DefaultActionMap: Normal @@ -499,9 +627,12 @@ MonoBehaviour: speed: 10 jumpForce: 20 hammerCD: 1 + sickleCD: 10 + sicklePrefab: {fileID: 8280362330273855463, guid: 2e2fb120ae20d5e4faaad5a2a2fcca30, type: 3} inputDir: 0 isLanding: 0 hammerCDLeft: 0 + sickleCDLeft: 0 --- !u!1 &519420028 GameObject: m_ObjectHideFlags: 0 @@ -618,6 +749,145 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &839378814 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 839378815} + m_Layer: 0 + m_Name: "\u9570\u5200\u53D1\u5C04\u70B9" + m_TagString: Untagged + m_Icon: {fileID: 2488908585195742037, guid: 0000000000000000d000000000000000, type: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &839378815 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 839378814} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.921, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 326335323} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &971340854 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 971340855} + - component: {fileID: 971340856} + - component: {fileID: 971340857} + m_Layer: 0 + m_Name: "\u9570\u5200\u98DE\u51FA\u6D88\u9664\u89E6\u53D1\u5668\u5DE6" + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &971340855 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 971340854} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -8.74, y: 1.47, z: 0} + m_LocalScale: {x: 1, y: 16.891874, z: 1} + m_Children: [] + m_Father: {fileID: 326335323} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &971340856 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 971340854} + 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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!61 &971340857 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 971340854} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 --- !u!1 &1460260701 GameObject: m_ObjectHideFlags: 0 @@ -690,194 +960,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1584056867 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1584056870} - - component: {fileID: 1584056869} - - component: {fileID: 1584056868} - m_Layer: 0 - m_Name: "\u9570\u5200" - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1584056868 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1584056867} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4d0390bd8b8ffd640b34fe25065ff1df, type: 3} - m_Name: - m_EditorClassIdentifier: - updateType: 0 - isSpeedBased: 0 - hasOnStart: 0 - hasOnPlay: 0 - hasOnUpdate: 0 - hasOnStepComplete: 0 - hasOnComplete: 0 - hasOnTweenCreated: 0 - hasOnRewind: 0 - onStart: - m_PersistentCalls: - m_Calls: [] - onPlay: - m_PersistentCalls: - m_Calls: [] - onUpdate: - m_PersistentCalls: - m_Calls: [] - onStepComplete: - m_PersistentCalls: - m_Calls: [] - onComplete: - m_PersistentCalls: - m_Calls: [] - onTweenCreated: - m_PersistentCalls: - m_Calls: [] - onRewind: - m_PersistentCalls: - m_Calls: [] - targetIsSelf: 1 - targetGO: {fileID: 0} - tweenTargetIsTargetGO: 1 - delay: 0 - duration: 0.15 - easeType: 1 - easeCurve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - loopType: 0 - loops: -1 - id: - isRelative: 0 - isFrom: 0 - isIndependentUpdate: 0 - autoKill: 0 - isActive: 1 - isValid: 1 - target: {fileID: 1584056870} - animationType: 4 - targetType: 11 - forcedTargetType: 0 - autoPlay: 1 - useTargetAsV3: 0 - endValueFloat: 0 - endValueV3: {x: 0, y: 0, z: -90} - endValueV2: {x: 0, y: 0} - endValueColor: {r: 1, g: 1, b: 1, a: 1} - endValueString: - endValueRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 0 - height: 0 - endValueTransform: {fileID: 0} - optionalBool0: 0 - optionalFloat0: 0 - optionalInt0: 0 - optionalRotationMode: 0 - optionalScrambleMode: 0 - optionalString: ---- !u!212 &1584056869 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1584056867} - 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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1, y: 1} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!4 &1584056870 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1584056867} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.356, y: 1.079, z: 0} - m_LocalScale: {x: 0.3, y: 0.3, z: 0.3} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1802393384 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/MyPlayer.cs b/Assets/Scripts/MyPlayer.cs index 2f9daf5..0765e57 100644 --- a/Assets/Scripts/MyPlayer.cs +++ b/Assets/Scripts/MyPlayer.cs @@ -35,6 +35,12 @@ public class MyPlayer : MonoBehaviour [BoxGroup("CD")] [Header("挥动锤子的CD时长")] public float hammerCD = 1f; + [BoxGroup("CD")] + [Header("发射镰刀的CD时长")] + public float sickleCD = 10f; + [Header("镰刀发射点Transform")] + [BoxGroup("预制体")] + public GameObject sicklePrefab; // _____ _ _ // | __ \ (_) | | @@ -52,7 +58,13 @@ public class MyPlayer : MonoBehaviour private SpriteRenderer hammerSprite; private BoxCollider2D hammerCollider; [BoxGroup("CD")][Header("挥动锤子的CD还剩多长时间")][SerializeField][ReadOnly] - private float hammerCDLeft = 0; + private float hammerCDLeft = 0f; + [BoxGroup("CD")][Header("发射镰刀的CD还剩多长时间")][SerializeField][ReadOnly] + private float sickleCDLeft = 0f; + private int faceDir = 1;//面部朝向 + private Transform sickleFirePoint; + private Transform sickleClearerL; + private Transform sickleClearerR; void Start() { @@ -76,6 +88,11 @@ public class MyPlayer : MonoBehaviour wavingAnimation = transform.Find("锤子的旋转中心").GetComponent(); hammerSprite = transform.Find("锤子的旋转中心").Find("锤子").GetComponent(); hammerCollider = transform.Find("锤子的旋转中心").Find("锤子").GetComponent(); + sickleFirePoint = transform.Find("镰刀发射点"); + sickleClearerL = transform.Find("镰刀飞出消除触发器左"); + sickleClearerL.gameObject.AddComponent(); + sickleClearerR = transform.Find("镰刀飞出消除触发器右"); + sickleClearerR.gameObject.AddComponent(); } //移动函数,处理水平方向移动 @@ -90,6 +107,18 @@ public class MyPlayer : MonoBehaviour private void CountCD() { if(hammerCDLeft > 0) hammerCDLeft -= Time.deltaTime; + if(sickleCDLeft > 0) sickleCDLeft -= Time.deltaTime; + } + + private void OnTurnAround() + { + faceDir = inputDir; + transform.localScale = new Vector3( //x乘-1以显示转身 + transform.localScale.x * -1, + //y、z不变 + transform.localScale.y, transform.localScale.z); + + } //碰撞检测代码 @@ -125,6 +154,11 @@ public class MyPlayer : MonoBehaviour if(!context.ReadValue().Equals(0)) inputDir = (context.ReadValue() > 0) ? 1 : -1; else inputDir = 0; + + if(faceDir * inputDir < 0) + { + OnTurnAround(); + } } public void OnJump(InputAction.CallbackContext context)//OnJump事件 @@ -151,6 +185,20 @@ public class MyPlayer : MonoBehaviour } } + public void OnSickle(InputAction.CallbackContext context) + { + if(context.started && sickleCDLeft <= 0) + { + Sickle sickle = Instantiate( + sicklePrefab, + sickleFirePoint.position, + Quaternion.identity). + GetComponent(); + sickle.dir = faceDir; + sickleCDLeft = sickleCD; + } + } + // ______ _ // | ____| | | // | |____ _____ _ __ | |_ @@ -167,7 +215,26 @@ public class MyPlayer : MonoBehaviour hammerSprite.DOFade(0,0f); //关闭锤子的碰撞体 hammerCollider.enabled = false; - } - + } + // _______ _ _____ _ + // |__ __| | |/ ____| | + // | | ___ ___ | | | | | __ _ ___ ___ + // | |/ _ \ / _ \| | | | |/ _` / __/ __| + // | | (_) | (_) | | |____| | (_| \__ \__ \ + // |_|\___/ \___/|_|\_____|_|\__,_|___/___/ + + + + private class SickleClearer : MonoBehaviour + { + //一个工具小插件,单独写脚本实在太浪费,所以在这里写一下。 + //当触发器检测到有东西进入,会试图获取它身上的镰刀脚本,如果有就说明镰刀到屏幕边缘了,把这个镰刀删除 + //没有的话说明是其他物体,不作处理 + void OnTriggerEnter2D(Collider2D other) + { + if(other.TryGetComponent(out Sickle temp)) + Destroy(temp.gameObject); + } + } } diff --git a/Assets/Scripts/Sickle.cs b/Assets/Scripts/Sickle.cs index a0f7ead..0543382 100644 --- a/Assets/Scripts/Sickle.cs +++ b/Assets/Scripts/Sickle.cs @@ -1,42 +1,31 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using Sirenix.OdinInspector; -// ............................................................... -// ............................................................... -// ..............................................\@@]............. -// ...............................................@@@@\........... -// ...............................................,@@@@@`......... -// ................................................=@@@@@\........ -// .................................................=@@@@@\....... -// ..................................................\@@@@@\...... -// ...................................................@@@@@@@..... -// ...................................................,@@@@@@^.... -// ....................................................=@@@@@@.... -// .....................................................@@@@@@^... -// .....................................................=@@@@@@... -// ......................................................@@@@@@`.. -// ......................................................@@@@@@^.. -// ......................................................@@@@@@^.. -// ......................................................@@@@@@^.. -// ......................................................@@@@@@^.. -// ..........................,@@@\......................=@@@@@@... -// ...................../\,]@@@@@@\.....................@@@@@@/... -// ................../@@@@@@@@@@@@@@.................../@@@@@@`... -// ................,@@@@@@@,@@@@@@@@@\................@@@@@@@^.... -// .............,O@@@@@@@^...\@@@@@@@@@\............/@@@@@@@/..... -// ..........,/@@@@@@@/[......\@@@@@@@@@@@]......,@@@@@@@@@/...... -// ......../@@@@@@@@/...........@@@@@@@@@@@@@@@@@@@@@@@@@@/....... -// .....,O@@@@@@@@/..............,@@@@@@@@@@@@@@@@@@@@@@/......... -// ....=@@@@@@@@/..................,\@@@@@@@@@@@@@@@@@/........... -// ....@@@O@@@/.......................,\@@@@@@@@@@@@`............. -// ....,@@@@/...............................[[[................... -// ......[`....................................................... -// ............................................................... -// ............................................................... +// ............................... +// .......................@@`..... +// ........................@@@.... +// ........................,@@@`.. +// .........................=@@@.. +// ..........................@@@\. +// ..........................=@@@. +// ...........................@@@^ +// ...........................@@@^ +// ............,@@\..........=@@@. +// ........,@@@@@@@\.........@@@/. +// ......]@@@@`.\@@@@\...../@@@@.. +// ...,O@@@/.....,@@@@@@@@@@@@/... +// ..@@@@/.........,@@@@@@@@/..... +// ..\@/................[......... +// ............................... public class Sickle : MonoBehaviour { + [ReadOnly][BoxGroup("信息")] + public int dir; + [BoxGroup("信息")] + public float speed = 10f; // Start is called before the first frame update void Start() @@ -47,6 +36,16 @@ public class Sickle : MonoBehaviour // Update is called once per frame void Update() { + Move(); + } + + void Move() + { + transform.position = transform.position += + new Vector3(//x + speed * Time.deltaTime * dir, + //y//z + 0,0); }