任务:搭建基本的系统

1.编写塞钱箱逻辑
(1.初始为有钱
(2.创建事件,当被塞钱,修改塞钱箱状态
(3.创建事件,当被拿钱,修改塞钱箱状态
(*:修改塞钱箱继承自普通可交互物体

2.编写玩家塞钱逻辑
(1.创建交互按键,当检测到交互执行,执行所catch物体的OnCall,根据所catch物体不同触发不同的动作。当catch到的是塞钱箱,执行塞钱功能
(2.创建塞钱功能,持有特殊金币-1

3.修改爱欲品掉钱逻辑
(1.修改死亡事件,当检测到主人为地藏并且玩家身上已经没钱了的时候,生成一个特殊硬币

4.编写特殊硬币逻辑
(1.继承于可交互物体(×)
(2.OnCall的时候触发玩家加钱功能
(3.物理层上不与除地面以外的其他东西碰撞
(4.捡拾上,给硬币添加一个子物体,通过子物体上的触发器和攻击类来判断捡拾与否

5.编写地藏拿钱攻击逻辑
(*.参照钟的逻辑
(1.新建地藏手
(2.新建组件:地藏手
(3.收到攻击信号后,从外部从上至下伸入一只手,伴随抖动,到一定位置后停止
(4.手有碰撞体,触碰到玩家时,对玩家造成伤害
(5.抄一段普通怪物的受击逻辑,当手被攻击了,触发动画,稍微抬起一小段,并且剧烈震动,同时通知主人被打

6.整理脚本

至此,关卡已经能按照正常的逻辑跑起来了
This commit is contained in:
Roman 2021-12-11 02:12:12 +08:00
parent 5bff5da713
commit 37ccc08c85
22 changed files with 1027 additions and 41 deletions

View File

@ -49,6 +49,14 @@ public class @Player : IInputActionCollection, IDisposable
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Interactive"",
""type"": ""Button"",
""id"": ""7cf0a787-dc2d-42b1-9ed9-c840ccfa3ce9"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
@ -183,6 +191,28 @@ public class @Player : IInputActionCollection, IDisposable
""action"": ""Sickle"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""d5e36b3d-645c-4a18-914e-7a7ae9046eda"",
""path"": ""<XInputController>/buttonNorth"",
""interactions"": """",
""processors"": """",
""groups"": ""Play"",
""action"": ""Interactive"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""30b75de0-1d5e-403d-8da3-a8da696490ee"",
""path"": ""<Keyboard>/f"",
""interactions"": """",
""processors"": """",
""groups"": ""Play"",
""action"": ""Interactive"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@ -212,6 +242,7 @@ public class @Player : IInputActionCollection, IDisposable
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);
m_Normal_Interactive = m_Normal.FindAction("Interactive", throwIfNotFound: true);
}
public void Dispose()
@ -265,6 +296,7 @@ public class @Player : IInputActionCollection, IDisposable
private readonly InputAction m_Normal_Jump;
private readonly InputAction m_Normal_Wave;
private readonly InputAction m_Normal_Sickle;
private readonly InputAction m_Normal_Interactive;
public struct NormalActions
{
private @Player m_Wrapper;
@ -273,6 +305,7 @@ public class @Player : IInputActionCollection, IDisposable
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 InputAction @Interactive => m_Wrapper.m_Normal_Interactive;
public InputActionMap Get() { return m_Wrapper.m_Normal; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@ -294,6 +327,9 @@ public class @Player : IInputActionCollection, IDisposable
@Sickle.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle;
@Sickle.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle;
@Sickle.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnSickle;
@Interactive.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteractive;
@Interactive.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteractive;
@Interactive.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteractive;
}
m_Wrapper.m_NormalActionsCallbackInterface = instance;
if (instance != null)
@ -310,6 +346,9 @@ public class @Player : IInputActionCollection, IDisposable
@Sickle.started += instance.OnSickle;
@Sickle.performed += instance.OnSickle;
@Sickle.canceled += instance.OnSickle;
@Interactive.started += instance.OnInteractive;
@Interactive.performed += instance.OnInteractive;
@Interactive.canceled += instance.OnInteractive;
}
}
}
@ -329,5 +368,6 @@ public class @Player : IInputActionCollection, IDisposable
void OnJump(InputAction.CallbackContext context);
void OnWave(InputAction.CallbackContext context);
void OnSickle(InputAction.CallbackContext context);
void OnInteractive(InputAction.CallbackContext context);
}
}

View File

@ -36,6 +36,14 @@
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Interactive",
"type": "Button",
"id": "7cf0a787-dc2d-42b1-9ed9-c840ccfa3ce9",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [
@ -170,6 +178,28 @@
"action": "Sickle",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "d5e36b3d-645c-4a18-914e-7a7ae9046eda",
"path": "<XInputController>/buttonNorth",
"interactions": "",
"processors": "",
"groups": "Play",
"action": "Interactive",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "30b75de0-1d5e-403d-8da3-a8da696490ee",
"path": "<Keyboard>/f",
"interactions": "",
"processors": "",
"groups": "Play",
"action": "Interactive",
"isComposite": false,
"isPartOfComposite": false
}
]
}

View File

@ -309,3 +309,5 @@ MonoBehaviour:
catchOffset: {x: 0, y: 0, z: 0}
breakFreeCount: 5
breakFreeCountLeft: 0
hasOwner: 0
coinObj: {fileID: 2312258847787666435, guid: 012ab20ff74f1af4e802d80157b4b4e0, type: 3}

View File

@ -0,0 +1,232 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &830885186
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 830885187}
- component: {fileID: 830885188}
m_Layer: 0
m_Name: "\u6361\u62FE"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &830885187
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 830885186}
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_Children: []
m_Father: {fileID: 2312258847787666463}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &830885188
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 830885186}
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, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!1 &2312258847787666435
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2312258847787666463}
- component: {fileID: 2312258847787666462}
- component: {fileID: 2312258847787666433}
- component: {fileID: 2312258847787666432}
- component: {fileID: 2312258847787666460}
- component: {fileID: 1219690094}
m_Layer: 6
m_Name: "\u786C\u5E01"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2312258847787666463
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.01860857, y: -2.61, z: 0}
m_LocalScale: {x: 0.3, y: 0.3, z: 0.3}
m_Children:
- {fileID: 830885187}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2312258847787666462
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
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 &2312258847787666433
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 6200000, guid: 6129a8c119a09f446a90609124f9bfbe, type: 2}
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
--- !u!50 &2312258847787666432
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!114 &2312258847787666460
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1b5bb24587f94d94f81dfbe3ac6df31c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_rigidbody: {fileID: 0}
--- !u!61 &1219690094
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312258847787666435}
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: 2.62, y: 1}
m_EdgeRadius: 0

View File

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

View File

@ -179,6 +179,7 @@ GameObject:
- component: {fileID: 295389548}
- component: {fileID: 295389547}
- component: {fileID: 295389549}
- component: {fileID: 295389550}
m_Layer: 0
m_Name: "\u585E\u94B1\u7BB1"
m_TagString: Untagged
@ -263,7 +264,34 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b74c9082c8d1a6044b40dfae78d89cab, type: 3}
m_Name:
m_EditorClassIdentifier:
hasMoney: 0
itemName: 0
hasMoney: 1
--- !u!61 &295389550
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 295389546}
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 &525554315
GameObject:
m_ObjectHideFlags: 0
@ -274,7 +302,7 @@ GameObject:
m_Component:
- component: {fileID: 525554317}
- component: {fileID: 525554316}
m_Layer: 0
m_Layer: 8
m_Name: "\u7A7A\u6C14\u5899\uFF08\u53F3"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -403,6 +431,8 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1871661725}
- {fileID: 575347545}
- {fileID: 2086773092}
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -435,6 +465,7 @@ MonoBehaviour:
- {fileID: 28312535}
- {fileID: 2059592404}
CallAiYuPinEndTime: 5
throwingPointGroupUse: []
--- !u!61 &552131611
BoxCollider2D:
m_ObjectHideFlags: 0
@ -506,6 +537,152 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &575347544
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 575347545}
- component: {fileID: 575347546}
- component: {fileID: 575347547}
- component: {fileID: 575347548}
- component: {fileID: 575347549}
m_Layer: 2
m_Name: "\u624B"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &575347545
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575347544}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 10, z: 0}
m_LocalScale: {x: 1, y: 10.01, z: 1}
m_Children: []
m_Father: {fileID: 552131609}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &575347546
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575347544}
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: 3
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 &575347547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575347544}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9301adfb53cc18946a129399d50298bf, type: 3}
m_Name:
m_EditorClassIdentifier:
owner: {fileID: 0}
TakeMoneyTime: 2
--- !u!61 &575347548
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575347544}
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
--- !u!50 &575347549
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575347544}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 200
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!1 &609324641
GameObject:
m_ObjectHideFlags: 0
@ -517,7 +694,7 @@ GameObject:
- component: {fileID: 609324642}
- component: {fileID: 609324644}
- component: {fileID: 609324643}
m_Layer: 0
m_Layer: 3
m_Name: "\u9570\u5200\u98DE\u51FA\u6D88\u9664\u89E6\u53D1\u5668\u53F3"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -630,7 +807,7 @@ GameObject:
- component: {fileID: 761593105}
- component: {fileID: 761593104}
- component: {fileID: 761593103}
m_Layer: 0
m_Layer: 3
m_Name: "\u73A9\u5BB6"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -745,6 +922,22 @@ MonoBehaviour:
m_CallState: 2
m_ActionId: d92eaf00-7eaf-4292-ae80-6bfff20b5930
m_ActionName: Normal/Sickle[/Keyboard/u,/XInputControllerWindows/rightTrigger]
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 761593105}
m_TargetAssemblyTypeName: MyPlayer, Assembly-CSharp
m_MethodName: OnInteractive
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: 7cf0a787-dc2d-42b1-9ed9-c840ccfa3ce9
m_ActionName: Normal/Interactive[/XInputControllerWindows/buttonNorth,/Keyboard/f]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: Play
m_DefaultActionMap: Normal
@ -769,14 +962,16 @@ MonoBehaviour:
sicklePrefab: {fileID: 8280362330273855463, guid: 2e2fb120ae20d5e4faaad5a2a2fcca30, type: 3}
HP: 10
hitToflyParameter: {x: 10, y: 10}
isCatching: 0
catingAiYuPin: {fileID: 0}
catching: {fileID: 0}
specialMoneyCount: 0
inputDir: 0
isLanding: 0
hammerCDLeft: 0
sickleCDLeft: 0
inControl: 1
HPLeft: 0
isCatching: 0
catingAiYuPin: {fileID: 0}
--- !u!50 &761593106
Rigidbody2D:
serializedVersion: 4
@ -903,7 +1098,7 @@ GameObject:
m_Component:
- component: {fileID: 861291080}
- component: {fileID: 861291081}
m_Layer: 0
m_Layer: 3
m_Name: "\u9524\u5B50\u7684\u65CB\u8F6C\u4E2D\u5FC3"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -1510,7 +1705,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1226109627}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.037861586, y: -1.6225245, z: -10}
m_LocalPosition: {x: 0.037862062, y: -1.6225212, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -1723,7 +1918,7 @@ GameObject:
- component: {fileID: 1322954041}
- component: {fileID: 1322954040}
- component: {fileID: 1322954039}
m_Layer: 0
m_Layer: 3
m_Name: "\u9524\u5B50"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -1929,7 +2124,7 @@ GameObject:
- component: {fileID: 1625727453}
- component: {fileID: 1625727455}
- component: {fileID: 1625727454}
m_Layer: 0
m_Layer: 3
m_Name: "\u9570\u5200\u98DE\u51FA\u6D88\u9664\u89E6\u53D1\u5668\u5DE6"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -2176,7 +2371,7 @@ GameObject:
m_Component:
- component: {fileID: 1678223710}
- component: {fileID: 1678223709}
m_Layer: 0
m_Layer: 8
m_Name: "\u7A7A\u6C14\u5899\uFF08\u5DE6"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -2526,7 +2721,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1954591987}
m_Layer: 0
m_Layer: 3
m_Name: "\u9570\u5200\u53D1\u5C04\u70B9"
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -2558,7 +2753,7 @@ GameObject:
- component: {fileID: 1963485815}
- component: {fileID: 1963485814}
- component: {fileID: 1963485816}
m_Layer: 0
m_Layer: 8
m_Name: "01-1\u573A\u666F\u8349\u56FE"
m_TagString: "\u5730\u9762"
m_Icon: {fileID: 0}
@ -2830,6 +3025,36 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2086773091
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2086773092}
m_Layer: 2
m_Name: "\u624B\u7684\u7EC8\u70B9\u4F4D\u7F6E"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2086773092
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086773091}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.12, y: 4.8, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 552131609}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2132302661
GameObject:
m_ObjectHideFlags: 0

View File

@ -30,6 +30,16 @@ public class AiYuPin : NormalEnemy
/// </summary>
[Header("玩家挣脱爱欲品还需要多少次方向转换操作")][FoldoutGroup("爱欲品")][ReadOnly]
public int breakFreeCountLeft;
/// <summary>
/// 这个爱欲品有主人吗?也就是地藏
/// </summary>
[HideInInspector]
public bool hasOwner;
/// <summary>
/// 打死后掉落的钱的预制体
/// </summary>
[Header("打死后掉落的钱的预制体")][FoldoutGroup("预制体")]
public GameObject coinObj;
// _____ _ _
// | __ \ (_) | |
@ -78,6 +88,7 @@ public class AiYuPin : NormalEnemy
//初始化爱欲品属性
breakFreeCountLeft = breakFreeCount;//初始化挣脱需要的操作次数
target = FindObjectOfType<MyPlayer>().transform;//初始化追踪目标为玩家
if(FindObjectOfType<DiZang>()) hasOwner = true;
}
/// <summary>
@ -96,6 +107,21 @@ public class AiYuPin : NormalEnemy
transform.rotation.z);
}
/// <summary>
/// 制造一个特殊的钱,用来塞钱的那种
/// </summary>
private void MakeAnCoin(){
GameObject coin = Instantiate(
coinObj,
transform.position,
Quaternion.identity
);
coin.GetComponent<Rigidbody2D>().velocity = new Vector2(
Random.Range(-1f,1f),
Random.Range(-1f,1f)
).normalized * (5f);
}
// ______ _
// | ____| | |
// | |____ _____ _ __ | |_
@ -190,6 +216,15 @@ public class AiYuPin : NormalEnemy
FindObjectOfType<MyPlayer>().BreakFreeCompletely();
}
protected override void OnDead(){
base.OnDead();
if(
hasOwner &&
target.GetComponent<MyPlayer>().specialMoneyCount == 0 &&
FindObjectOfType<Coin>() == null
)MakeAnCoin();
}
/// <summary>
/// 玩家尝试挣脱的时候触发这个
/// </summary>

50
Assets/Scripts/Coin.cs Normal file
View File

@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 用来塞的钱那个类,但是是小怪打死后掉落的那种
/// </summary>
[RequireComponent(typeof(BoxCollider2D))]
[RequireComponent(typeof(Rigidbody2D))]
public class Coin : MonoBehaviour
{
public Rigidbody2D m_rigidbody;
void Start(){
Init();
}
void Init(){
m_rigidbody = GetComponent<Rigidbody2D>();
transform.GetChild(0).gameObject.AddComponent<PickUpCoin>().owner = this;
}
public void PlayerPickUpMe(){
Destroy(gameObject);
}
/// <summary>
/// 本类的工具类,初始化时给子物体装一个组件,用来检测玩家是否能捡拾硬币
/// </summary>
private class PickUpCoin : Interactive
{
/// <summary>
/// 这个捡拾范围所存在于的硬币
/// </summary>
public Coin owner;
void Start(){
Init();
}
private void Init(){
itemName = ItemName.;
}
public override void OnCall(){
owner.PlayerPickUpMe();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b5bb24587f94d94f81dfbe3ac6df31c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -62,6 +62,7 @@ public class DiZang : Enemy
[SerializeField][ListDrawerSettings][ReadOnly]
private List<ThrowingPoint> throwingPointGroupUse;
private Bell myBell;
private DiZangsHadn myHand;
// _____ _ _ ____ _
// / ____| | | | _ \ | |
@ -84,7 +85,8 @@ public class DiZang : Enemy
//找到组件和物体
moneyBox = FindObjectOfType<MoneyBox>();
player = FindObjectOfType<MyPlayer>();
myBell = transform.GetChild(0).GetComponent<Bell>();
myBell = transform.Find("钟").GetComponent<Bell>();
myHand = transform.Find("手").GetComponent<DiZangsHadn>();
//告诉钟自己是主人
myBell.owner = this;
}
@ -110,7 +112,7 @@ public class DiZang : Enemy
/// 召唤爱欲品的时候Call这个
/// </summary>
private IEnumerator CallAiYuPin(){
Debug.Log("正在使用召唤");
Debug.Log("正在使用:召唤");
//确定玩家在上半边还是下半边
PlayerState playerState =
((player.transform.position.y > aiYuPinBuildLimit) ? PlayerState.: PlayerState.);
@ -158,7 +160,7 @@ public class DiZang : Enemy
/// 敲钟的时候Call这个
/// </summary>
private IEnumerator RingTheBell(){
Debug.Log("正在使用敲钟");
Debug.Log("正在使用:敲钟");
yield return new WaitForEndOfFrame();
myBell.ATK(player);
}
@ -168,8 +170,8 @@ public class DiZang : Enemy
/// </summary>
private IEnumerator TakeTheMoney(){
yield return new WaitForEndOfFrame();
Debug.Log("正在使用拿钱");
Debug.Log("正在使用:拿钱");
myHand.ATK();
}
// ______ _

View File

@ -0,0 +1,197 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Sirenix.OdinInspector;
/// <summary>
/// 地藏的手组件
/// </summary>
public class DiZangsHadn : MonoBehaviour
{
// _____ _ _ _
// | __ \ | | | (_)
// | |__) | _| |__ | |_ ___
// | ___/ | | | '_ \| | |/ __|
// | | | |_| | |_) | | | (__
// |_| \__,_|_.__/|_|_|\___|
[HideInInspector]
public DiZang owner;
/// <summary>
/// 手下落到目标点后会停留多长时间
/// </summary>
public float TakeMoneyTime;
// _____ _ _
// | __ \ (_) | |
// | |__) | __ ___ ____ _| |_ ___
// | ___/ '__| \ \ / / _` | __/ _ \
// | | | | | |\ V / (_| | || __/
// |_| |_| |_| \_/ \__,_|\__\___|
/// <summary>
/// 手拿钱移动到的目标点位
/// </summary>
private Transform target;
/// <summary>
/// 浮动动画,用来重启浮动动画解决Tween的一些局限性问题
/// </summary>
private Tweener floatTweener;
/// <summary>
/// 手在屏幕外的起点
/// </summary>
private Vector3 start;
/// <summary>
/// 此时是否可被攻击
/// </summary>
[Header("此时能否被攻击")][SerializeField]
private bool canBeHit = false;
/// <summary>
/// 是否被玩家的攻击打断了?
/// </summary>
[Header("此时是否被打断")][SerializeField]
private bool wasInteruput;
// _____ _ _ ____ _
// / ____| | | | _ \ | |
// | | __ _| | | |_) | __ _ ___| | __
// | | / _` | | | _ < / _` |/ __| |/ /
// | |___| (_| | | | |_) | (_| | (__| <
// \_____\__,_|_|_|____/ \__,_|\___|_|\_\
void Start(){Init();}
// _ _ _
// | \ | | | |
// | \| | ___ _ __ _ __ ___ __ _| |
// | . ` |/ _ \| '__| '_ ` _ \ / _` | |
// | |\ | (_) | | | | | | | | (_| | |
// |_| \_|\___/|_| |_| |_| |_|\__,_|_|
private void Init(){
//找到需要的物体和组件
owner = FindObjectOfType<DiZang>();
target = owner.transform.Find("手的终点位置");
start = transform.position;
}
/// <summary>
/// 主人发命令拿钱时触发
/// </summary>
public void ATK(){
//创建、播放并记录一个抖动动画
Tweener floatTweener = transform.DOShakePosition(2f,0.05f,50,90,false,false);
this.floatTweener = floatTweener;
//创建、播放并记录一个下移动画
Tweener tweener = transform.DOMoveY(
target.position.y,
2f
);
//创建并给予下移动画结束事件
TweenCallback action = () =>{
//下移结束,标记为可被攻击
canBeHit = true;
//删掉正在播放的抖动动画
floatTweener.Kill();
//拿走钱
FindObjectOfType<MoneyBox>().OnBeTakeMoney();
//开始协程,等待拿钱时间结束后上移回去手
Invoke("TakeMoneyAndRun",TakeMoneyTime);
};
tweener.OnComplete(action);
}
/// <summary>
/// 手到塞钱箱后触发,执行等待和返回操作
/// </summary>
private void TakeMoneyAndRun(){
//如果没有被打断,才会执行正常的上移
if(!wasInteruput){
//创建、播放并记录一个抖动动画
Tweener floatTweener = transform.DOShakePosition(2f,0.05f,50,90,false,false);
this.floatTweener = floatTweener;
//创建、播放并记录一个上移动画
Tweener tweener = transform.DOMoveY(
start.y,
2f
);
//创建并给予下移动画结束事件
TweenCallback action = () =>{
//为下一次下移做准备,标记自身不可再被击中
canBeHit = false;
//删掉抖动动画
floatTweener.Kill();
//通知主人,攻击结束
owner.ATKEnd();
};
tweener.OnComplete(action);
}
}
// ______ _
// | ____| | |
// | |____ _____ _ __ | |_
// | __\ \ / / _ \ '_ \| __|
// | |___\ V / __/ | | | |_
// |______\_/ \___|_| |_|\__|
/// <summary>
/// 当创到玩家触发,触发玩家的被击功能
/// </summary>
private void OnTouchThePlayer(MyPlayer player){
//告诉玩家,你被攻击了
player.OnBeHit(owner.ATK,
((transform.position.x -
player.transform.position.x)
> 0) ? 1 : -1);//通过自身位置和玩家位置的比较来返回玩家本次的受击方向
}
/// <summary>
/// 当手被攻击触发
/// </summary>
public void OnBeHit(MyPlayer.AtkMethod hitMethod, int hitDir){
//标记此时被打断
wasInteruput = true;
CancelInvoke("TakeMoneyAndRun");
//突然抬起一段,伴随着剧烈的震动
//创建、播放并记录一个抖动动画
Tweener floatTweener = transform.DOShakePosition(0.5f,0.5f,50,90,false,false);
this.floatTweener = floatTweener;
//创建一个猛烈上移动画
Tweener tweener = transform.DOMoveY(
transform.position.y + 2f,
0.5f
);
//给猛烈上移动画添加结束事件
TweenCallback action = () =>{
floatTweener.Kill();
canBeHit = false;
wasInteruput = false;
Invoke("TakeMoneyAndRun",TakeMoneyTime);
};
tweener.OnComplete(action);
//结算生命值
owner.HPLeft -= MyPlayer.atkMethodMagnification[hitMethod];
//看下死了没
if(owner.CheckDead()) {}
}
// _____ _ _ _ _
// / ____| | | (_) (_)
// | | ___ | | |_ ___ _ ___ _ __
// | | / _ \| | | / __| |/ _ \| '_ \
// | |___| (_) | | | \__ \ | (_) | | | |
// \_____\___/|_|_|_|___/_|\___/|_| |_|
protected void OnCollisionEnter2D(Collision2D other)//当有物体碰上
{
if(other.collider.gameObject.TryGetComponent<MyPlayer>(out MyPlayer player))
{OnTouchThePlayer(player);}//如果创到的是玩家则Call事件
//如果被镰刀创到Call一下OnBeHit事件传入攻击方式和攻击来袭方向
else if(other.collider.gameObject.TryGetComponent<Sickle>(out Sickle sickle)){
if(canBeHit)
OnBeHit(MyPlayer.AtkMethod.,
(transform.position.x - sickle.transform.position.x > 0) ? -1 : 1);
Destroy(sickle.gameObject);}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9301adfb53cc18946a129399d50298bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -64,7 +64,7 @@ public class Enemy : MonoBehaviour
/// 当前生命值
/// </summary>
[ReadOnly][SerializeField][ProgressBar(0,10,0.15f,0.47f,0.74f)][FoldoutGroup("状态")]
protected float HPLeft;
public float HPLeft;
// ______ _
@ -110,7 +110,7 @@ public class Enemy : MonoBehaviour
/// <summary>
/// 看看死了没
/// </summary>
protected bool CheckDead(){return !(HPLeft > 0);}
public bool CheckDead(){return !(HPLeft > 0);}
// _____ _ _ _ _

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 可交互物体基类
/// </summary>
public class Interactive : MonoBehaviour
{
/// <summary>
/// 这个是什么东西
/// </summary>
public enum ItemName{
,
};
public ItemName itemName;
//这是一对碰撞检测代码。当玩家进入将自身传给玩家。当玩家退出把玩家的catch清空
void OnTriggerEnter2D(Collider2D other){
if(other.TryGetComponent<MyPlayer>(out MyPlayer player))
player.catching = this;
}
void OnTriggerExit2D(Collider2D other)
{
if(other.TryGetComponent<MyPlayer>(out MyPlayer player)){
//如果目前退出当前交互区域的时候,玩家的捕捉物体是自己,才把玩家的捕捉清空。否则说明玩家在推出前就捕捉到了新的
//对象。这样是用来解决排布密集的可交互物体的问题
if(player.catching == this)player.catching = null;
}
}
public virtual void OnCall(){}
public virtual void OnBeGaveMoney(){}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 32fadff7625f74747a7fb890f3ff39df
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
/// <summary>
/// 塞钱箱类
/// </summary>
public class MoneyBox : MonoBehaviour
[RequireComponent(typeof(BoxCollider2D))]
public class MoneyBox : Interactive
{
/// <summary>
/// 箱子里有钱吗?
/// </summary>
public bool hasMoney = false;
public bool hasMoney;
void Start(){
Init();
}
private void Init(){
itemName = ItemName.;
}
public override void OnCall(){
OnBeGaveMoney();
}
/// <summary>
/// 当被塞钱的时候触发
/// </summary>
public override void OnBeGaveMoney(){hasMoney = true;}
/// <summary>
/// 当被拿钱的时候触发
/// </summary>
public void OnBeTakeMoney(){hasMoney = false;}
}

View File

@ -17,9 +17,9 @@ public class MyPlayer : MonoBehaviour
// | | | |_| | |_) | | | (__
// |_| \__,_|_.__/|_|_|\___|
[Header("玩家平时地面移动的速度")][FoldoutGroup("Info")]
[Header("玩家平时地面移动的速度")][FoldoutGroup("属性")]
public float speed = 10f;
[Header("玩家跳跃力度的大小")][FoldoutGroup("Info")]
[Header("玩家跳跃力度的大小")][FoldoutGroup("属性")]
public float jumpForce = 10f;
[FoldoutGroup("CD")][Header("挥动锤子的CD时长")]
public float hammerCD = 1f;
@ -31,7 +31,7 @@ public class MyPlayer : MonoBehaviour
/// <summary>
/// 生命值上限
/// </summary>
[FoldoutGroup("Info")][Header("生命值上限")]
[FoldoutGroup("属性")][Header("生命值上限")]
public float HP;
/// <summary>
/// 被击飞后的飞行方向的调整值
@ -46,7 +46,7 @@ public class MyPlayer : MonoBehaviour
/// <summary>
/// 记录此时自己是否被爱欲品缠抱
/// </summary>
[Header("被缠抱了吗?")][SerializeField][ReadOnly][FoldoutGroup("Info")]
[Header("被缠抱了吗?")][SerializeField][ReadOnly][FoldoutGroup("状态")]
public bool isCatching = false;
/// <summary>
/// 正抓着玩家的爱欲品
@ -54,6 +54,17 @@ public class MyPlayer : MonoBehaviour
[HideInInspector]
public AiYuPin catingAiYuPin;
/// <summary>
/// 玩家此时捕捉着的可交互物体
/// </summary>
[Header("玩家此时捕捉着的可交互物体")][FoldoutGroup("状态")][ReadOnly]
public Interactive catching;
/// <summary>
/// 当前身上有多少特殊硬币,用来塞钱的那种
/// </summary>
[FoldoutGroup("状态")][Header("当前身上有多少特殊硬币,用来塞钱的那种")]
public int specialMoneyCount = 0;
// _____ _ _
// | __ \ (_) | |
// | |__) | __ ___ ____ _| |_ ___
@ -62,9 +73,9 @@ public class MyPlayer : MonoBehaviour
// |_| |_| |_| \_/ \__,_|\__\___|
private Rigidbody2D m_rigidbody;//自身刚体组件
[SerializeField][ReadOnly][FoldoutGroup("Info")]
[SerializeField][ReadOnly][FoldoutGroup("状态")]
private int inputDir;//当前输入方向,-1左1右0静止
[SerializeField][ReadOnly][FoldoutGroup("Info")]
[SerializeField][ReadOnly][FoldoutGroup("状态")]
private bool isLanding;//记录自己当前是否着地
private DOTweenAnimation wavingAnimation;//锤子挥动动画组件
private SpriteRenderer hammerSprite;//锤子的图片组件
@ -77,9 +88,9 @@ public class MyPlayer : MonoBehaviour
private Transform sickleFirePoint;//镰刀发射点的transform
private Transform sickleClearerL;//左边的镰刀清除触发器
private Transform sickleClearerR;//右边的镰刀清除触发器
[FoldoutGroup("其他",false,1)][Header("玩家现在是否处于控制状态下(物理)")][SerializeField][ReadOnly]
[FoldoutGroup("状态",false,1)][Header("玩家现在是否处于控制状态下(物理)")][SerializeField][ReadOnly]
private bool inControl = true;
[SerializeField][ReadOnly][ProgressBar(0,10,0.15f,0.47f,0.74f)][FoldoutGroup("Info")]
[SerializeField][ReadOnly][ProgressBar(0,10,0.15f,0.47f,0.74f)][FoldoutGroup("状态")]
private float HPLeft;
/// <summary>
/// 自身动画控制器组件
@ -226,6 +237,20 @@ public class MyPlayer : MonoBehaviour
HPLeft -= FindObjectOfType<AiYuPin>().ATK;
}
/// <summary>
/// 塞钱
/// </summary>
private void GiveMoney(){
specialMoneyCount--;
}
/// <summary>
/// 捡到钱了
/// </summary>
private void IPickedACoin(){
specialMoneyCount++;
}
// _____ _ _ _ _
// / ____| | | (_) (_)
// | | ___ | | |_ ___ _ ___ _ __
@ -301,18 +326,37 @@ public class MyPlayer : MonoBehaviour
public void OnSickle(InputAction.CallbackContext context)
{
if(context.started && sickleCDLeft <= 0 && inControl)
{
if(context.started && sickleCDLeft <= 0 && inControl){
Sickle sickle = Instantiate(
sicklePrefab,
sickleFirePoint.position,
Quaternion.identity).
GetComponent<Sickle>();
sicklePrefab,
sickleFirePoint.position,
Quaternion.identity
).GetComponent<Sickle>();
sickle.dir = faceDir;
sickleCDLeft = sickleCD;
}
}
public void OnInteractive(InputAction.CallbackContext context){
if(context.performed && catching != null){
switch(catching.itemName){
case Interactive.ItemName. :
if(
specialMoneyCount > 0 &&
!FindObjectOfType<MoneyBox>().hasMoney
){
catching.OnCall();
GiveMoney();
}
break;
case Interactive.ItemName. :
IPickedACoin();
catching.OnCall();
break;
}
}
}
// ______ _
// | ____| | |
// | |____ _____ _ __ | |_

View File

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u5F39\u6027"
friction: 0.4
bounciness: 0.5

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6129a8c119a09f446a90609124f9bfbe
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -135,3 +135,13 @@ C# parse time : 185ms
candidates check time : 34ms
console write time : 0ms
[api-updater (non-obsolete-error-filter)] 2021/12/11 0:02:14 : Starting D:/unity/Editor/2020.3.20f1c1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 835.39ms
moved types parse time: 53ms
candidates parse time : 1ms
C# parse time : 673ms
candidates check time : 49ms
console write time : 1ms

View File

@ -53,4 +53,4 @@ Physics2DSettings:
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: bfffffffbfffffffbfffffffbfffffffbfffffffbfffffff00ffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

View File

@ -10,12 +10,12 @@ TagManager:
- Default
- TransparentFX
- Ignore Raycast
-
- "\u73A9\u5BB6"
- Water
- UI
-
-
-
- "\u786C\u5E01"
- "\u602A\u7269"
- "\u5730\u9762"
-
-
-