diff --git a/meng_yao/Assets/Prefabs/charatar/enemy/min_1.prefab b/meng_yao/Assets/Prefabs/charatar/enemy/min_1.prefab index 9d84735f..099a03bd 100644 --- a/meng_yao/Assets/Prefabs/charatar/enemy/min_1.prefab +++ b/meng_yao/Assets/Prefabs/charatar/enemy/min_1.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 4703411402065954782} - component: {fileID: 4703411402755586928} - component: {fileID: 4703411402755586929} + - component: {fileID: 6468108308622956862} m_Layer: 0 m_Name: min_1 m_TagString: Enemy @@ -144,6 +145,17 @@ MonoBehaviour: isAnimationPlay: 1 mycollider: {fileID: 0} attackClass: {fileID: 0} +--- !u!210 &6468108308622956862 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4703411402065954783} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 2 --- !u!1 &4703411402469012869 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab b/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab new file mode 100644 index 00000000..26d0dbbd --- /dev/null +++ b/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab @@ -0,0 +1,304 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8433650274046349753 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8433650274046349754} + - component: {fileID: 8433650274046349755} + m_Layer: 0 + m_Name: Circle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8433650274046349754 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650274046349753} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1.4, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8433650275485930555} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &8433650274046349755 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650274046349753} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 21300000, guid: 10f4a8c446cc49c4194e42f42cfc2be7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 21.605274, y: 19.199999} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &8433650274814453344 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8433650274814453345} + m_Layer: 0 + m_Name: attack + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8433650274814453345 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650274814453344} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8433650275485930555} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8433650275485930554 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8433650275485930555} + - component: {fileID: 8433650274028726421} + - component: {fileID: 8433650274028726420} + - component: {fileID: -3836672401185760439} + - component: {fileID: 1143474233500709369} + m_Layer: 0 + m_Name: tutu + m_TagString: Player + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8433650275485930555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650275485930554} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.2, y: 0.2, z: 0.2} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 8433650274814453345} + - {fileID: 8433650274046349754} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8433650274028726421 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650275485930554} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 28012bb73bbdd3a4f881dda28759bfa4, type: 3} + m_Name: + m_EditorClassIdentifier: + retbutton: {fileID: 0} + ClosureObj: {fileID: 0} + waypoints: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + moveSpeed: 0.005 +--- !u!114 &8433650274028726420 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650275485930554} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1d85d2602d10e0b45820f1be35eda782, type: 3} + m_Name: + m_EditorClassIdentifier: + retbutton: {fileID: 0} + ClosureObj: {fileID: 0} + camp: 0 + hp: 100 + gold: 10 + physicalArmor: 10 + magicArmor: 5 + Navigation: {fileID: 8433650274028726421} + AnimationTree: + - value: + - {fileID: 21300000, guid: 7a9ea5910ce547648b91fb17f66423b0, type: 3} + - {fileID: 21300000, guid: 4d963c29e6d03d246bfc81716c85c695, type: 3} + - {fileID: 21300000, guid: 3d9fbac889d5ad5409d8a8bb65c7ba3a, type: 3} + - {fileID: 21300000, guid: f2bf7d1ed23ca8842a32692ae3b5e04d, type: 3} + - {fileID: 21300000, guid: e0e33f77929297d478a8dfa0cd6459dc, type: 3} + - {fileID: 21300000, guid: 0a2d3050b4672614cb15b5ae8111dc00, type: 3} + - {fileID: 21300000, guid: 3944bd14050da4946b4fe3f283c636b5, type: 3} + - {fileID: 21300000, guid: a42bbb04049b44144b89057baa808b07, type: 3} + - {fileID: 21300000, guid: a7b17c91a88493b4fbf3479111ad8529, type: 3} + - {fileID: 21300000, guid: 214e6e4e1961c1c48b8614047e962e6b, type: 3} + - {fileID: 21300000, guid: 91b75ac7cef7fab4691af1f133486d28, type: 3} + - {fileID: 21300000, guid: 3377bd6700dff1f4ebe4454a514d3822, type: 3} + - {fileID: 21300000, guid: d09a76c73317e394ba72ae06615e8d8e, type: 3} + - {fileID: 21300000, guid: 022be9ed82b88ca448e83895645aaf7f, type: 3} + - {fileID: 21300000, guid: 6ba220237d59af346988c1a0ee610e54, type: 3} + - {fileID: 21300000, guid: 528ed6f5efb74ca4bb7d600f57f72431, type: 3} + - {fileID: 21300000, guid: 29915f89081bacc4aaa782696eacb03d, type: 3} + - {fileID: 21300000, guid: 94a05f4a221d2a44489218dbdaefef3d, type: 3} + - {fileID: 21300000, guid: ffb2866f43fa6cb4ca43e8a5d60e1287, type: 3} + - {fileID: 21300000, guid: 99fe2b5de63b7c3459d723663e8c005f, type: 3} + - {fileID: 21300000, guid: 10f4a8c446cc49c4194e42f42cfc2be7, type: 3} + - {fileID: 21300000, guid: c7f9e1c4f70d9144082368f6f4d63848, type: 3} + - {fileID: 21300000, guid: 592bbc50c8a486c4693fb8cf27b29670, type: 3} + - {fileID: 21300000, guid: 869a9492ecc04f64795d4700b2e08183, type: 3} + - {fileID: 21300000, guid: ced9891523af42843b0821b6370c24c5, type: 3} + - {fileID: 21300000, guid: 30f24a49e65cf1e4090e348eda66977d, type: 3} + - {fileID: 21300000, guid: a9f88c6bb2de4cf489245f8e183532cc, type: 3} + - {fileID: 21300000, guid: ebb8f39c7c40b6345bfc40ace0649b44, type: 3} + - {fileID: 21300000, guid: adf29684fc00dd5498af7609d9036470, type: 3} + - {fileID: 21300000, guid: 29b3d4ab5f0a7294b845a60e42fd3289, type: 3} + - {fileID: 21300000, guid: 826586e7feecc1d4bad51475454dd002, type: 3} + - {fileID: 21300000, guid: a48c5c5d2bc1d0d4bb8530f1bffbf00c, type: 3} + CharacterAnimationFrameInterval: 50 + - value: + - {fileID: 21300000, guid: 5065ad587b7ca8e4a82e33c40797e307, type: 3} + - {fileID: 21300000, guid: 7a3a190ce8913cc40a19c276da784c4e, type: 3} + - {fileID: 21300000, guid: b0bbef8c103df11429e8eb9fee7c5f3a, type: 3} + - {fileID: 21300000, guid: dce3028a1e881f64a949b087da35995f, type: 3} + - {fileID: 21300000, guid: 431a64a62dcb4ee4f86a8d44378dc9fe, type: 3} + - {fileID: 21300000, guid: 246c11ed5132c4649b8643231deb6829, type: 3} + - {fileID: 21300000, guid: 567f557f73a5d2d488a6463f6e9813d6, type: 3} + - {fileID: 21300000, guid: c0684f77ee86af7488e2f2094acc1970, type: 3} + - {fileID: 21300000, guid: 39ee156552d65b247beab58a57672cde, type: 3} + - {fileID: 21300000, guid: 89e87207a9a2c6144920c482ff527c55, type: 3} + - {fileID: 21300000, guid: 365237f0b749d0948b1ce7a642b5b622, type: 3} + - {fileID: 21300000, guid: 0888c240589273c42b1f3c50447226eb, type: 3} + - {fileID: 21300000, guid: f9cfc1050580be247ba87ba770ccdf75, type: 3} + - {fileID: 21300000, guid: 4b41eb7dadefd8949b2fb9b3408ed313, type: 3} + - {fileID: 21300000, guid: be0b21d56e75af044aba0864cebdbaa2, type: 3} + - {fileID: 21300000, guid: c916ec9a55e39f54bad7d3279c2ace77, type: 3} + - {fileID: 21300000, guid: 8c3ac93f9484210448ed89847a18facf, type: 3} + - {fileID: 21300000, guid: 1aebb49de6d7b5743a9b09b4b8775c51, type: 3} + - {fileID: 21300000, guid: ae8336216ed56da49a2c57218e5f27ac, type: 3} + - {fileID: 21300000, guid: 8a8eb57cfe13f91448f27c4b6f71165b, type: 3} + - {fileID: 21300000, guid: 03e864cdc0386d94784d1706fb2185e1, type: 3} + - {fileID: 21300000, guid: 34ae2a6dfc5da69418692bb75f621ac3, type: 3} + - {fileID: 21300000, guid: 025e32d6b33a56e4898c1dab011c844a, type: 3} + - {fileID: 21300000, guid: 101d265eefe88004c8b30bae46aaeed9, type: 3} + CharacterAnimationFrameInterval: 50 + animationHighlight: 0 + spriteRenderer: {fileID: 8433650274046349755} + image: {fileID: 0} + isAnimationPlay: 1 + mycollider: {fileID: 0} + attackClass: {fileID: 0} +--- !u!61 &-3836672401185760439 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650275485930554} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0.17129514, y: 0.20476732} + 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: 0.851952, y: 0.8627128} + m_EdgeRadius: 0 +--- !u!210 &1143474233500709369 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8433650275485930554} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 2 diff --git a/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab.meta b/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab.meta new file mode 100644 index 00000000..35ac8259 --- /dev/null +++ b/meng_yao/Assets/Prefabs/charatar/enemy/tutu.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bef8166752f077848ade0206b11f2d55 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/Scenes/New/Scene_Fire.unity b/meng_yao/Assets/Scenes/New/Scene_Fire.unity index 64e589d8..d37e2d96 100644 --- a/meng_yao/Assets/Scenes/New/Scene_Fire.unity +++ b/meng_yao/Assets/Scenes/New/Scene_Fire.unity @@ -1776,7 +1776,7 @@ Transform: - {fileID: 1932457213} - {fileID: 1109401242} - {fileID: 1500347571} - - {fileID: 7538587764676493414} + - {fileID: 1154379873} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3741,7 +3741,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} @@ -3757,6 +3757,38 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.42, y: 1.45} m_EdgeRadius: 0 +--- !u!210 &682806287 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682806283} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 +--- !u!50 &682806288 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682806283} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.0001 + 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: 0 --- !u!1 &683663196 GameObject: m_ObjectHideFlags: 0 @@ -6555,6 +6587,37 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1150803932} m_CullTransparentMesh: 1 +--- !u!1 &1154379872 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1154379873} + m_Layer: 0 + m_Name: Prefabinstance + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1154379873 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1154379872} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -4.31, y: -8.36, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 284432670} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1158472051 GameObject: m_ObjectHideFlags: 0 @@ -7642,7 +7705,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} @@ -7658,6 +7721,38 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.42, y: 1.45} m_EdgeRadius: 0 +--- !u!210 &1309322548 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309322544} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 +--- !u!50 &1309322549 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309322544} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.0001 + 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: 0 --- !u!1 &1326163020 GameObject: m_ObjectHideFlags: 0 @@ -8377,7 +8472,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} @@ -8393,6 +8488,38 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.42, y: 1.45} m_EdgeRadius: 0 +--- !u!210 &1494345152 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 301702498} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 +--- !u!50 &1494345153 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 301702498} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.0001 + 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: 0 --- !u!4 &1500347571 stripped Transform: m_CorrespondingSourceObject: {fileID: 4703411402065954782, guid: aac4ad2c72526a54691494dd54e115a6, type: 3} @@ -8439,6 +8566,82 @@ RectTransform: m_AnchoredPosition: {x: 0, y: -1} m_SizeDelta: {x: 0, y: 2} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1522492426 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1522492427} + - component: {fileID: 1522492429} + - component: {fileID: 1522492428} + m_Layer: 5 + m_Name: mash + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1522492427 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522492426} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2088000979} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 220, y: 290} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1522492428 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522492426} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.7058824} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: dab6101c2a5349c43a399e3101cb2617, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1522492429 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522492426} + m_CullTransparentMesh: 1 --- !u!1 &1552201271 GameObject: m_ObjectHideFlags: 0 @@ -10058,7 +10261,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} @@ -10074,6 +10277,38 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.42, y: 1.45} m_EdgeRadius: 0 +--- !u!210 &1839958991 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701790962} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 +--- !u!50 &1839958992 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701790962} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.0001 + 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: 0 --- !u!1 &1855256961 GameObject: m_ObjectHideFlags: 0 @@ -11091,7 +11326,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} @@ -11107,6 +11342,38 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.42, y: 1.45} m_EdgeRadius: 0 +--- !u!210 &2054916118 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2054916114} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 +--- !u!50 &2054916119 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2054916114} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.0001 + 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: 0 --- !u!1 &2057874716 GameObject: m_ObjectHideFlags: 0 @@ -11312,6 +11579,7 @@ RectTransform: m_Children: - {fileID: 88722264} - {fileID: 961041081} + - {fileID: 1522492427} m_Father: {fileID: 1136445683} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -11422,7 +11690,11 @@ MonoBehaviour: cardIconImage: {fileID: 1691595504} cardicon: {fileID: 21300000, guid: 7a9ea5910ce547648b91fb17f66423b0, type: 3} targetTag: tower - mengyaoPrefab: {fileID: 0} + mengyaoPrefab: {fileID: 8433650275485930554, guid: bef8166752f077848ade0206b11f2d55, type: 3} + mask: {fileID: 1522492426} + camera: {fileID: 636646498} + PrefabParent: {fileID: 1154379872} + mY: {fileID: 0} --- !u!1 &2095962040 GameObject: m_ObjectHideFlags: 0 @@ -11900,265 +12172,6 @@ PrefabInstance: - target: {fileID: 4703411402842800734, guid: aac4ad2c72526a54691494dd54e115a6, type: 3} propertyPath: m_Sprite value: - objectReference: {fileID: 21300000, guid: 9656f7f1ea8e7594c97e495041aa4581, type: 3} + objectReference: {fileID: 21300000, guid: 5a21d33cca7048a46aed91d4e3e32ec3, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: aac4ad2c72526a54691494dd54e115a6, type: 3} ---- !u!114 &7538587763185777864 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587764676493415} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 28012bb73bbdd3a4f881dda28759bfa4, type: 3} - m_Name: - m_EditorClassIdentifier: - retbutton: {fileID: 0} - ClosureObj: {fileID: 0} - waypoints: - - {fileID: 734893407} - - {fileID: 1597666921} - - {fileID: 530562779} - - {fileID: 1116367165} - - {fileID: 1552201272} - - {fileID: 920394797} - - {fileID: 7595786} - - {fileID: 3435906} - - {fileID: 16085906} - - {fileID: 11828202} - moveSpeed: 0.005 ---- !u!114 &7538587763185777865 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587764676493415} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1d85d2602d10e0b45820f1be35eda782, type: 3} - m_Name: - m_EditorClassIdentifier: - retbutton: {fileID: 0} - ClosureObj: {fileID: 0} - camp: 1 - hp: 100 - gold: 10 - physicalArmor: 10 - magicArmor: 5 - Navigation: {fileID: 7538587763185777864} - AnimationTree: - - value: - - {fileID: 21300000, guid: a29d3d1d32f24994f9c1bee0c38b5c54, type: 3} - - {fileID: 21300000, guid: bfcbd9279315aed4aae131893f77f91d, type: 3} - - {fileID: 21300000, guid: 3b79872eebb5c2741883266b6b3d2045, type: 3} - - {fileID: 21300000, guid: 51af4f86e2e554f4985fd64e0b0f1e3c, type: 3} - - {fileID: 21300000, guid: 57d35e7424996004e851d5648c055617, type: 3} - - {fileID: 21300000, guid: 645dca14ffff13041862597ed96cee91, type: 3} - - {fileID: 21300000, guid: 17418500f7e782949b69c4fbce59f6ba, type: 3} - - {fileID: 21300000, guid: 839012168e591124c8be757f8e9e94e4, type: 3} - - {fileID: 21300000, guid: aa6f66265746cb041bbfdf887abe64f9, type: 3} - - {fileID: 21300000, guid: c4efbb2f5c422e54dbada9af34b3aa09, type: 3} - - {fileID: 21300000, guid: 57a2c545c106f914d9e6acf89e4f2f5d, type: 3} - - {fileID: 21300000, guid: 84a26d718c953fb4f86bb6bb6a84f089, type: 3} - - {fileID: 21300000, guid: f4576d09b35f51b44b673ff5b732789b, type: 3} - - {fileID: 21300000, guid: 1bca20d390cce0d459bd7678f656e8d2, type: 3} - - {fileID: 21300000, guid: 9656f7f1ea8e7594c97e495041aa4581, type: 3} - - {fileID: 21300000, guid: cebb0d54c57db444d8b1f48aab88bb48, type: 3} - - {fileID: 21300000, guid: 97cc9a8eaafc8d24a849cc7f6ceb3b13, type: 3} - - {fileID: 21300000, guid: 72a01706836824e40a2c6e4285bd237f, type: 3} - - {fileID: 21300000, guid: 412cb158edac32c4aadbe6d96d9d58b6, type: 3} - - {fileID: 21300000, guid: dea3ad36e27729844ad982c8d30f5b94, type: 3} - - {fileID: 21300000, guid: 91b932ffe078985478f1e828c27487a3, type: 3} - - {fileID: 21300000, guid: 221590061d7640c40af0fe198d09af64, type: 3} - - {fileID: 21300000, guid: 8d48232a51f3f834ea31963af1692a71, type: 3} - - {fileID: 21300000, guid: 2a9c43eb111cab3499a539e031a452fc, type: 3} - - {fileID: 21300000, guid: 12419610ed7771d4896569438e1884e9, type: 3} - - {fileID: 21300000, guid: 080493c198f5d2644adf4cc5d2d877c5, type: 3} - - {fileID: 21300000, guid: 7047995b6a71e1342845a01bbca956e0, type: 3} - - {fileID: 21300000, guid: ce5c6aba1ecb2b64e965152e2c779955, type: 3} - - {fileID: 21300000, guid: 5fdc02cc28955354681ddffb7b09085a, type: 3} - - {fileID: 21300000, guid: 6cf0aac06e7aa984fb4cb41ff799b710, type: 3} - - {fileID: 21300000, guid: 5a21d33cca7048a46aed91d4e3e32ec3, type: 3} - - {fileID: 21300000, guid: 409a36959cb9c794a8a72a51ca29eb3c, type: 3} - - {fileID: 21300000, guid: e0e86e375a0004c47b26c1510431b4ab, type: 3} - - {fileID: 21300000, guid: 81f10bc693229ec44be331839e6d7d27, type: 3} - - {fileID: 21300000, guid: 0b98f7c80a18aa544a59829d0d8e8cb5, type: 3} - - {fileID: 21300000, guid: 84ea23eac94f8e84bb75e7c77f95447e, type: 3} - - {fileID: 21300000, guid: cab320b3f45281448944a1a9c46cc762, type: 3} - - {fileID: 21300000, guid: 1657ff3f38d87b94586a400f5834025c, type: 3} - CharacterAnimationFrameInterval: 50 - - value: - - {fileID: 21300000, guid: d0e97f96cf7eb544ab3a5fa66cd90b76, type: 3} - - {fileID: 21300000, guid: d5d7283b4ed2eb84d8c769594f12ea17, type: 3} - - {fileID: 21300000, guid: 1ec9f5c667d625341afa0b3cfffa60d8, type: 3} - - {fileID: 21300000, guid: 06c39cff70398d342bbe78d85482fce3, type: 3} - - {fileID: 21300000, guid: cd6fe1b5f0af9d6489b24dc45fc8ca41, type: 3} - - {fileID: 21300000, guid: f63b831d3a2692348b77b3ffafd0d4be, type: 3} - - {fileID: 21300000, guid: 95de37a42e0a97e4693dd00bd705cda8, type: 3} - - {fileID: 21300000, guid: 176c1356f1f1d20419e811d6e324a2ae, type: 3} - - {fileID: 21300000, guid: edc05cb6ef6f1a74da9052acc99d3fba, type: 3} - - {fileID: 21300000, guid: 23b031aabc6e45744b2f4a52ff7d1795, type: 3} - - {fileID: 21300000, guid: 4760b866b183d0547831e027468cd816, type: 3} - - {fileID: 21300000, guid: d354dd3eb7053324f97e19f4e8806045, type: 3} - - {fileID: 21300000, guid: 6bae05c1b7ed03044aa4498f65b75b98, type: 3} - - {fileID: 21300000, guid: f4b340d40b92169439104e91216e7f6e, type: 3} - CharacterAnimationFrameInterval: 50 - animationHighlight: 0 - spriteRenderer: {fileID: 7538587763306153446} - image: {fileID: 0} - isAnimationPlay: 1 - mycollider: {fileID: 0} - attackClass: {fileID: 0} ---- !u!1 &7538587763306153444 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7538587763306153447} - - component: {fileID: 7538587763306153446} - m_Layer: 0 - m_Name: Circle - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!212 &7538587763306153446 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587763306153444} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - 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: 21300000, guid: ce5c6aba1ecb2b64e965152e2c779955, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 21.605274, y: 19.199999} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!4 &7538587763306153447 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587763306153444} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 4.43, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 7538587764676493414} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &7538587764005024316 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587764005024317} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 7538587764676493414} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &7538587764005024317 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7538587764005024316} - m_Layer: 0 - m_Name: attack - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7538587764676493414 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538587764676493415} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.64, y: 6.6, z: 0} - m_LocalScale: {x: 0.26, y: 0.26, z: 0.26} - m_ConstrainProportionsScale: 1 - m_Children: - - {fileID: 7538587764005024316} - - {fileID: 7538587763306153447} - m_Father: {fileID: 284432670} - m_RootOrder: 5 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &7538587764676493415 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7538587764676493414} - - component: {fileID: 7538587763185777864} - - component: {fileID: 7538587763185777865} - m_Layer: 0 - m_Name: tutu - m_TagString: Enemy - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 diff --git a/meng_yao/Assets/script/A_Fight/cardContorl.cs b/meng_yao/Assets/script/A_Fight/cardContorl.cs index 18b8ac9e..acc8be40 100644 --- a/meng_yao/Assets/script/A_Fight/cardContorl.cs +++ b/meng_yao/Assets/script/A_Fight/cardContorl.cs @@ -17,15 +17,27 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD public string targetTag; [Header("生成的萌妖预制体")] public GameObject mengyaoPrefab; - private Transform recordParent;//记录父节点 + + public GameObject mask; + + public Camera camera; + + //生成物体的预制体 + public GameObject PrefabParent; + + [HideInInspector] + public GameObject mY; private Vector3 startPos;//记录一开始的位置 + //private SpriteAniation spriteAniation; // Start is called before the first frame update void Start() { this.cardIconImage.sprite = cardicon; this.startPos = this.transform.position; - Debug.Log(this.startPos); + + mask.SetActive(false); + //Debug.Log(this.startPos); //spriteAniation = GetComponent(); //spriteAniation.enabled = false; } @@ -35,9 +47,17 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD { - this.recordParent = this.transform.parent; - GameObject mengyaoprefab = Instantiate(mengyaoPrefab); + //this.recordParent = this.transform.parent; + mY = Instantiate(mengyaoPrefab,PrefabParent.transform); + Vector3 mousePosition = Input.mousePosition; + // 将鼠标屏幕坐标转换为世界坐标 + mousePosition = camera.ScreenToWorldPoint(new Vector3(mousePosition.x, mousePosition.y, 0)); + + // 将物体的位置更新为鼠标的位置 + mY.transform.position = mousePosition; + + this.transform.SetParent(canvas.transform); //throw new System.NotImplementedException(); @@ -45,35 +65,37 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD // 拖拽中 public void OnDrag(PointerEventData eventData) { - this.transform.position = Input.mousePosition; - mengyaoPrefab.transform.position = Input.mousePosition; - + + Vector3 mousePosition = Input.mousePosition; + + // 将鼠标屏幕坐标转换为世界坐标 + mousePosition = camera.ScreenToWorldPoint(new Vector3(mousePosition.x, mousePosition.y, camera.nearClipPlane)); + + // 强制设置Z轴为0(或者根据你的需求设置成其他值) + mousePosition.z = 0; + + // 将物体的位置更新为鼠标的位置 + mY.transform.position = mousePosition; + } // 拖拽结束 public void OnEndDrag(PointerEventData eventData) { - // 检测鼠标下的目标 - List results = new List(); - EventSystem.current.RaycastAll(eventData, results); - - foreach (var result in results) + if (mY.GetComponent().isInTrigger) { - if (result.gameObject.CompareTag(targetTag)) // 检测目标是否为目标点 - { - Debug.Log("成功放置到目标区域!"); - transform.SetParent(result.gameObject.transform); // 设置为目标点的子物体 - transform.localPosition = Vector3.zero; // 重置位置 - this.enabled = false;//禁用自己 - - //spriteAniation.enabled = true; - return; - } + mY.transform.localPosition = Vector3.zero; + mY.GetComponent().enabled = false; + this.enabled = false; + mask.SetActive(true); } - - // 如果不在目标区域,返回原始父节点 - Debug.Log("未放置到目标区域,返回原位置"); - transform.SetParent(recordParent); - transform.position = this.startPos; // 重置到原始位置 - Debug.Log(transform.localPosition); + else + { + Destroy(mY); + } + } + + + + } diff --git a/meng_yao/Assets/script/A_Fight/enemy.cs b/meng_yao/Assets/script/A_Fight/enemy.cs index df27975b..c1f9354c 100644 --- a/meng_yao/Assets/script/A_Fight/enemy.cs +++ b/meng_yao/Assets/script/A_Fight/enemy.cs @@ -2,18 +2,53 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class enemy:Role +public class enemy : Role { + private Transform parent; + + public bool isInTrigger { get; set; } + // Start is called before the first frame update public override void Start() { base.Start(); - Navigation.MoveToNextWaypoint(this.gameObject); + if (camp == Camp.Enemy) + { + Navigation.MoveToNextWaypoint(this.gameObject); + } + isInTrigger = false; } - // Update is called once per frame - void Update() + + + private void OnTriggerEnter2D(Collider2D collision) { - + if (!isInTrigger) + { + Debug.Log("物体第一次进入触发器"); + isInTrigger = true; + + } + } + + private void OnTriggerExit2D(Collider2D collision) + { + if (isInTrigger) + { + Debug.Log("物体退出触发器"); + + isInTrigger = false; + } + } + + private void OnTriggerStay2D(Collider2D collision) + { + // 仅在物体持续在触发器内时,执行某些操作 + if (isInTrigger) + { + Debug.Log("物体持续在触发器内"); + // 在这里进行物体持续在触发器内时的操作 + this.transform.SetParent(collision.transform); + } } }