怪物死亡动画,萌妖攻击动画,战魂掉落动画,修bug

This commit is contained in:
wulongxiao 2024-12-14 23:20:55 +08:00
parent ae9baf0325
commit d560ce058d
12 changed files with 393 additions and 16 deletions

View File

@ -26,7 +26,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 492886037456412146}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 1.2, y: 0.22, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:

View File

@ -4847,7 +4847,7 @@ CircleCollider2D:
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.3
m_Radius: 0.1
--- !u!1 &6998733212867358586
GameObject:
m_ObjectHideFlags: 0

View File

@ -95,8 +95,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
minScale: {x: 2, y: 2, z: 2}
maxScale: {x: 2.5, y: 2.5, z: 2.5}
duration: 0.1
moveSpeed: 1
duration: 1
moveSpeed: 0.5
fadeDuration: 0
moveDistance: 2
moveDistance: 1
targetCanvas: {fileID: 0}

View File

@ -180,6 +180,7 @@ MonoBehaviour:
Hpfiil: {fileID: 6236648196338733329}
HpTextPrefab: {fileID: 6292166076641120080, guid: 4a7236e471dd72b4299671c7330ec483, type: 3}
_Canvas: {fileID: 4205844203331515742}
zhanhunPrefab: {fileID: 6697713946806966764, guid: b1a4ddbbc3a518644bab6bfb25cb7851, type: 3}
gold: 10
physicalArmor: 10
magicArmor: 5
@ -247,7 +248,7 @@ MonoBehaviour:
isAnimationPlay: 1
mycollider: {fileID: 0}
attackClass: {fileID: 0}
CurrentIndex: 21
CurrentIndex: 33
enemyId:
harmNumber: 0
--- !u!210 &6468108308622956862
@ -426,7 +427,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 221590061d7640c40af0fe198d09af64, type: 3}
m_Sprite: {fileID: 21300000, guid: 81f10bc693229ec44be331839e6d7d27, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0

View File

@ -0,0 +1,98 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3829812713419463650
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3506120171962153097}
- component: {fileID: 6436353741186186787}
- component: {fileID: 2047206942293143115}
m_Layer: 0
m_Name: zhanhun
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3506120171962153097
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3829812713419463650}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.719, y: -0.037, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6436353741186186787
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3829812713419463650}
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: 25b48d23815d787459348452908b18ae, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.72, y: 0.92}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!210 &2047206942293143115
SortingGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3829812713419463650}
m_Enabled: 1
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 5

View File

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

View File

@ -73,7 +73,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 55eab326be617db43ab0e843058ece17, type: 3}
m_Sprite: {fileID: 21300000, guid: dba3d4cfa3cc4ed45ae94cd405f73532, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
@ -218,6 +218,9 @@ MonoBehaviour:
camp: 0
hp: 100
dieIndex: -1
Hpfiil: {fileID: 0}
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
gold: 10
physicalArmor: 10
magicArmor: 5
@ -263,12 +266,63 @@ MonoBehaviour:
- {fileID: 21300000, guid: 1e181695bb5e526499d88ab58396ac68, type: 3}
- {fileID: 21300000, guid: 1272b20769190c44ca52969270e1de4a, type: 3}
CharacterAnimationFrameInterval: 50
- value:
- {fileID: 21300000, guid: 8a0026cc8a968ac4aabc0c3240258a2a, type: 3}
- {fileID: 21300000, guid: c6b7dead3a76d264cbefc0a895b513e5, type: 3}
- {fileID: 21300000, guid: f9ded78a0bc9b4a4e8c37b7539622388, type: 3}
- {fileID: 21300000, guid: a51522ebd0d294a4e94349786d2d9733, type: 3}
- {fileID: 21300000, guid: 31838d137d00b914aa3b2a339a4c0c00, type: 3}
- {fileID: 21300000, guid: ac66168d10bcd8e46bfcba9a4752e926, type: 3}
- {fileID: 21300000, guid: ff80ac2aaeea96d4dae175455d237a84, type: 3}
- {fileID: 21300000, guid: b16923c0ae321cf47bbe70deb9cbd683, type: 3}
- {fileID: 21300000, guid: bf5adc6e8b8922d42b1350294b102e14, type: 3}
- {fileID: 21300000, guid: 844b7ebf78095b3419a7b1aac63565e2, type: 3}
- {fileID: 21300000, guid: 5aba49816da427046a333e700323115e, type: 3}
- {fileID: 21300000, guid: dba3d4cfa3cc4ed45ae94cd405f73532, type: 3}
- {fileID: 21300000, guid: 118ce5bd095efde48b3a16046a31ed6d, type: 3}
- {fileID: 21300000, guid: 62823ca78f02c284c81027a4e6ed5481, type: 3}
- {fileID: 21300000, guid: 65fc03007b67808429f1de73daed067c, type: 3}
- {fileID: 21300000, guid: a9daf146687d1f9479ce5d8e0721e641, type: 3}
- {fileID: 21300000, guid: cf67cba5e74afa14b9275abcb2496f12, type: 3}
- {fileID: 21300000, guid: 74501f3239c9ec44087503ed15bcad9a, type: 3}
- {fileID: 21300000, guid: 0ae660f254ffdb14d82d1de3a382f9fc, type: 3}
- {fileID: 21300000, guid: dbf649a66cd8a5f459b262d9ebcb0d70, type: 3}
- {fileID: 21300000, guid: 122a172c475ba7343b2d3d7289d7c74e, type: 3}
- {fileID: 21300000, guid: 897f7e557ed8a5e42b632e19b39347b1, type: 3}
- {fileID: 21300000, guid: d0401073776f4954d9b16284a85fa6cd, type: 3}
- {fileID: 21300000, guid: 7e06234bd5a219a49be5fa82426e5d74, type: 3}
- {fileID: 21300000, guid: 0c5f1485d5fd00843b7ea5a80061c730, type: 3}
- {fileID: 21300000, guid: 9b363a9f648b9f545b94ec8ef36309a2, type: 3}
- {fileID: 21300000, guid: b95be6474c729814a8b4caef21bc7ba3, type: 3}
- {fileID: 21300000, guid: 106aeb0c5bcbf40468e1559f91eac117, type: 3}
- {fileID: 21300000, guid: 55d6534cd6a402541a0c5333e1452a10, type: 3}
- {fileID: 21300000, guid: 7f7bf45a4f5c43d44a87f85f03dbc431, type: 3}
- {fileID: 21300000, guid: 1eb75365a307a0949b28dd5d6d189f5e, type: 3}
- {fileID: 21300000, guid: a9e300b0bd79114468b53cd3af6ba38f, type: 3}
- {fileID: 21300000, guid: c9da22bf45625024da55f34f07a8513b, type: 3}
- {fileID: 21300000, guid: 79f544d3747716549bc10d78a4d5f500, type: 3}
- {fileID: 21300000, guid: 4131e4498a463a84a935b611dd565b85, type: 3}
- {fileID: 21300000, guid: a5c48c6f20aeaf24bb39787bdf34127c, type: 3}
- {fileID: 21300000, guid: 52acd423067ba52478f29fd2dca6d430, type: 3}
- {fileID: 21300000, guid: c89ecf9612a68754786c36e2e6ab43a4, type: 3}
- {fileID: 21300000, guid: 125786bb02109634db3b063adb1ae4d2, type: 3}
- {fileID: 21300000, guid: 96b1004dd7c062948847e408dc0d06e5, type: 3}
- {fileID: 21300000, guid: f303f9b9a592be84db424c63d9451ddf, type: 3}
- {fileID: 21300000, guid: 2cd7bdf7740d0b84dabc07b686938293, type: 3}
- {fileID: 21300000, guid: ca85eab85a9ac7c43a5912e3039c1d48, type: 3}
- {fileID: 21300000, guid: 36c42ec3d45ea2c468eea6859a1c0404, type: 3}
- {fileID: 21300000, guid: 8cbb195232845234e820457ca89c8a66, type: 3}
- {fileID: 21300000, guid: f1683e58977695646b4153f87bce1c44, type: 3}
- {fileID: 21300000, guid: ca848163da8939946afd1eebdbc944ee, type: 3}
- {fileID: 21300000, guid: f7b5d6cc0cf67314c8bb5336147a8ca6, type: 3}
CharacterAnimationFrameInterval: 50
animationHighlight: 0
spriteRenderer: {fileID: 8433650274046349755}
image: {fileID: 0}
isAnimationPlay: 1
mycollider: {fileID: 1338343970434073545}
attackClass: {fileID: 7276635428522831207}
CurrentIndex: 0
enemyId:
harmNumber: 0
--- !u!61 &-3836672401185760439

View File

@ -73,7 +73,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ad0106d4b0f767247b4441512b528e89, type: 3}
m_Sprite: {fileID: 21300000, guid: cce02f3057f76474eb6bf00c47a4d300, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
@ -218,6 +218,9 @@ MonoBehaviour:
camp: 0
hp: 100
dieIndex: -1
Hpfiil: {fileID: 0}
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
gold: 10
physicalArmor: 10
magicArmor: 5
@ -263,12 +266,35 @@ MonoBehaviour:
- {fileID: 21300000, guid: 47f28cfc2fffa714b8d866b88d0dc57e, type: 3}
- {fileID: 21300000, guid: 70aae2f10edcd3b46a53b82e2191b77d, type: 3}
CharacterAnimationFrameInterval: 50
- value:
- {fileID: 21300000, guid: f162115c0aebc104cbda3d0863e7d39c, type: 3}
- {fileID: 21300000, guid: 4a1b605ee697f7f4d8399f471b63343d, type: 3}
- {fileID: 21300000, guid: 5c6a51db78dfa254ab45a1ac210279ff, type: 3}
- {fileID: 21300000, guid: 338b50c12d52dee4c94f1a0381a5231f, type: 3}
- {fileID: 21300000, guid: fc92a99e63aded5469e1a2005e6695f5, type: 3}
- {fileID: 21300000, guid: dbb3c5581e62721428ba630f9cf52ebb, type: 3}
- {fileID: 21300000, guid: cafd102863559c3448a56e383de85093, type: 3}
- {fileID: 21300000, guid: 0369e34ae494fff4197a4e05db114d74, type: 3}
- {fileID: 21300000, guid: a24dbc18f1e464643afcf77c67751f6c, type: 3}
- {fileID: 21300000, guid: b8d5680c2e871e94fae70d002b49e113, type: 3}
- {fileID: 21300000, guid: 99b3017f757ff494dbf8fe57f8e472a6, type: 3}
- {fileID: 21300000, guid: 9c353b3324d4f8846b356704b2fdcbb2, type: 3}
- {fileID: 21300000, guid: 7d33a073eb8606f4780d66552bae7aa6, type: 3}
- {fileID: 21300000, guid: 6c32a95165bb5ed4091c4b1acba68c2a, type: 3}
- {fileID: 21300000, guid: f9f1ccdc0d7b25a419a5560e50af165d, type: 3}
- {fileID: 21300000, guid: fc186bdafddba5b468899ede3d0a8dc3, type: 3}
- {fileID: 21300000, guid: df6cb156dec004d4a81311485e0343b9, type: 3}
- {fileID: 21300000, guid: b2d0ee46ba8ff7142938acacc7177b5d, type: 3}
- {fileID: 21300000, guid: fbfe7c2d7fc9c124082498ed423a1ed4, type: 3}
- {fileID: 21300000, guid: b2207077f8f04fb45970902f61a6b1a7, type: 3}
CharacterAnimationFrameInterval: 50
animationHighlight: 0
spriteRenderer: {fileID: 8433650274046349755}
image: {fileID: 0}
isAnimationPlay: 1
mycollider: {fileID: 1338343970434073545}
attackClass: {fileID: 7276635428522831207}
CurrentIndex: 0
enemyId:
harmNumber: 0
--- !u!61 &-3836672401185760439

View File

@ -1228,6 +1228,7 @@ GameObject:
- component: {fileID: 446083643}
- component: {fileID: 446083645}
- component: {fileID: 446083644}
- component: {fileID: 446083646}
m_Layer: 5
m_Name: currency
m_TagString: Untagged
@ -1247,6 +1248,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 768408985}
- {fileID: 984134418}
m_Father: {fileID: 408785964}
m_RootOrder: 0
@ -1294,6 +1296,19 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 446083642}
m_CullTransparentMesh: 1
--- !u!114 &446083646
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 446083642}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &453763627
GameObject:
m_ObjectHideFlags: 0
@ -1446,9 +1461,16 @@ MonoBehaviour:
expNumber: 0
expNumberText: {fileID: 385770246}
maxExpNumber: 20
zhanhunPrefab: {fileID: 3829812713419463650, guid: b1a4ddbbc3a518644bab6bfb25cb7851, type: 3}
MainCamera: {fileID: 636646498}
zhanhunicon: {fileID: 984134418}
shakeDuration: 0.5
shakeStrength: 0.1
finalMoveDuration: 1
infobox_skill: {fileID: 1801653805}
Skill: {fileID: 2105540892551905820, guid: 5ba5240922e49e04cbfd99f42f8c62a4, type: 3}
SkillParent: {fileID: 2035101381}
ExpFill: {fileID: 768408986}
ExpFileObj: {fileID: 732537458938328743, guid: 952564c9dd0531e4da92ba005feee1e0, type: 3}
ExpFilePrante: {fileID: 9463995}
expList: []
@ -2221,6 +2243,82 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &768408984
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 768408985}
- component: {fileID: 768408987}
- component: {fileID: 768408986}
m_Layer: 5
m_Name: fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &768408985
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 768408984}
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: 446083643}
m_RootOrder: 0
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: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &768408986
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 768408984}
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.2640322, g: 0.58858657, b: 0.9433962, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: ab18de750110df34ab62cb1b0bd6e2ce, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 1
m_FillAmount: 0.61
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &768408987
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 768408984}
m_CullTransparentMesh: 1
--- !u!1 &796332576
GameObject:
m_ObjectHideFlags: 0
@ -2869,7 +2967,7 @@ GameObject:
- component: {fileID: 984134420}
- component: {fileID: 984134419}
m_Layer: 5
m_Name: Image
m_Name: zhanhun
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -2888,7 +2986,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 446083643}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}

@ -1 +1 @@
Subproject commit 5e92a0630dc1112bc03996a6b2e56a0cd461ca9d
Subproject commit d266869186aa276f68fec88b78b6e0dc15d74881

View File

@ -1,3 +1,4 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -10,13 +11,22 @@ public class SkillBox : Base
[Header("战魂(经验)")] public int expNumber;
[Header("战魂(经验)")] public Text expNumberText;
[Header("最大战魂(经验)")] public int maxExpNumber;
[Header("生成的战魂")] public GameObject zhanhunPrefab;
public Camera MainCamera;
public RectTransform zhanhunicon;
public float shakeDuration = 0.5f; // 摆动的时间
public float shakeStrength = 0.1f; // 摆动的幅度
public float finalMoveDuration = 1f; // 飘动到经验槽的最终时间
public GameObject infobox_skill;
public GameObject Skill;
public Transform SkillParent;
[HideInInspector]
public Image ExpFill;
public int ExpNumber
{
get => expNumber;
@ -32,6 +42,8 @@ public class SkillBox : Base
public List<GameObject> expList = new List<GameObject>();
private void Start()
{
ExpFill.fillAmount = 0;
if (instance != null) return;
instance = this;
@ -41,6 +53,10 @@ public class SkillBox : Base
public void UpdataExp(int number)
{
if (number==0)
{
return;
}
if (number > 0)
{
@ -75,11 +91,86 @@ public class SkillBox : Base
for (int j = 0; j < 2; j++)
{
GameObject obj = Instantiate(Skill,SkillParent);
obj.GetComponent<Skill_Spend>().infobox_skill_up = infobox_skill;
obj.GetComponent<Skill_Spend>().MySkill = MengyaoInfo.Instance.m_SkillData[i].skills[j];
obj.GetComponent<Skill_Spend>().infobox_skill_up = infobox_skill;
obj.GetComponent<Skill_Spend>().MySkill = MengyaoInfo.Instance.m_SkillData[i].skills[j];
}
}
//Base.GlobalObj.GetComponent<gameGlobal>().CarryCardId.Clear();
}
public void GetZhanhun(int number)
{
minZhanHun(number);
}
void minZhanHun(int number)
{
// 获取当前经验值(从经验条的填充比例计算)
int currentExp = (int)(ExpFill.fillAmount * 10);
// 累加经验
currentExp += number;
// 检查是否升级,并更新经验条
while (currentExp >= 10)
{
currentExp -= 10;
UpdataExp(1);
}
// 更新经验条显示(计算当前经验和最大经验的比例)
float expFillAmount = (float)currentExp / 10;
ExpFill.fillAmount = expFillAmount; // 更新经验条UI显示
}
public void AddExperience(int amount,Transform pos)
{
//生成预制体并设置初始位置
GameObject expObj = Instantiate(zhanhunPrefab,pos.position, Quaternion.identity);
ShakeAndMoveToExpSlot(expObj, pos.position, amount);
}
// 物体摆动并飞到经验槽
private void ShakeAndMoveToExpSlot(GameObject expObj, Vector3 spawnPosition, int amount)
{
// 原地摆动
expObj.transform.DOShakePosition(shakeDuration, shakeStrength, 10, 90, false, true).OnComplete(() =>
{
// 获取UI目标的屏幕空间位置
Vector3 targetScreenPosition = ExpFill.transform.position;
// 将屏幕空间位置转换为世界空间位置
Vector3 targetWorldPosition = MainCamera.ScreenToWorldPoint(targetScreenPosition);
// 将z轴坐标设置为适合场景的值
targetWorldPosition.z = expObj.transform.position.z;
// 使用DOTween使得预制体飘动到目标位置
expObj.transform.DOMove(targetWorldPosition, 1f).SetEase(Ease.InOutQuad).OnComplete(() =>
{
// 飘动完成后更新经验条
GetZhanhun(amount);
AnimateExpSlotIcon();
Destroy(expObj); // 销毁飘动的物体
});
});
}
private void AnimateExpSlotIcon()
{
// 图标放大至原来的1.2倍
zhanhunicon.DOScale(1.2f, 0.1f).SetEase(Ease.OutBack).OnComplete(() =>
{
// 回到原来大小
zhanhunicon.DOScale(1f, 0.1f).SetEase(Ease.InBack);
});
}
}

View File

@ -9,6 +9,7 @@ public class enemy : Role
[HideInInspector]
public float harmNumber=0;//伤害
public float HarmNumber
{
get=> harmNumber;
@ -49,7 +50,8 @@ public class enemy : Role
// 将当前敌人对象放入死亡池
if (SpawnPool.intance != null )
{
SkillBox.instance.UpdataExp(10);
SkillBox.instance.AddExperience(6,this.gameObject.transform);
}
UIContorl.instance.Killnumber += 1;