add
This commit is contained in:
parent
ab29549151
commit
b9db3ff518
102
meng_yao/Assets/Prefabs/charatar/enemy/SnowHp.prefab
Normal file
102
meng_yao/Assets/Prefabs/charatar/enemy/SnowHp.prefab
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &6292166076641120080
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7885370385722281058}
|
||||||
|
- component: {fileID: 8034220339799651341}
|
||||||
|
- component: {fileID: 1663126517542853684}
|
||||||
|
- component: {fileID: 7426565245524278981}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: SnowHp
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &7885370385722281058
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6292166076641120080}
|
||||||
|
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: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: -347}
|
||||||
|
m_SizeDelta: {x: 749.3, y: 140.5}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &8034220339799651341
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6292166076641120080}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &1663126517542853684
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6292166076641120080}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 0, b: 0, 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_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 200
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 2
|
||||||
|
m_MaxSize: 200
|
||||||
|
m_Alignment: 4
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 1
|
||||||
|
m_VerticalOverflow: 1
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: 100
|
||||||
|
--- !u!114 &7426565245524278981
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6292166076641120080}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0ecc64720440ac541bd28a5c78ad2250, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
minScale: {x: 2, y: 2, z: 2}
|
||||||
|
maxScale: {x: 2.5, y: 2.5, z: 2.5}
|
||||||
|
duration: 0.1
|
||||||
|
moveSpeed: 1
|
||||||
|
fadeDuration: 0
|
||||||
|
moveDistance: 2
|
||||||
|
targetCanvas: {fileID: 0}
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4a7236e471dd72b4299671c7330ec483
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
63
meng_yao/Assets/Prefabs/charatar/enemy/SnowHpControl.cs
Normal file
63
meng_yao/Assets/Prefabs/charatar/enemy/SnowHpControl.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using DG.Tweening;
|
||||||
|
|
||||||
|
public class SnowHpControl : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Vector3 minScale = new Vector3(0f, 0.1f, 1f); // 最小缩放
|
||||||
|
public Vector3 maxScale = new Vector3(1f, 0.1f, 1f); // 最大缩放
|
||||||
|
public float duration = 1f; // 从min到max的时间
|
||||||
|
public float moveSpeed = 0.005f; // 向上飘动的速度
|
||||||
|
public float fadeDuration = 0f; // 消失时间(设置为零实现即时消失)
|
||||||
|
public float moveDistance = 2f; // 向上飘动的最大距离
|
||||||
|
public Canvas targetCanvas; // 目标画布,用于确保UI元素在该画布上移动
|
||||||
|
|
||||||
|
private Renderer rend; // 用于获取物体的Renderer来控制透明度
|
||||||
|
private Vector3 initialPosition;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
targetCanvas = transform.parent.GetComponent<Canvas>();
|
||||||
|
|
||||||
|
// 获取Renderer
|
||||||
|
rend = GetComponent<Renderer>();
|
||||||
|
|
||||||
|
// 确保血条的初始化位置在目标画布的正确位置上
|
||||||
|
if (targetCanvas.renderMode == RenderMode.WorldSpace)
|
||||||
|
{
|
||||||
|
// 如果目标画布是WorldSpace模式,使用世界坐标
|
||||||
|
initialPosition = transform.position;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果是ScreenSpace模式,我们需要转化屏幕坐标到世界坐标
|
||||||
|
initialPosition = targetCanvas.worldCamera.ScreenToWorldPoint(transform.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化血条的缩放
|
||||||
|
transform.localScale = minScale;
|
||||||
|
|
||||||
|
// 使用DOTween做缩放动画,从最小缩放到最大缩放
|
||||||
|
transform.DOScale(maxScale, duration).SetEase(Ease.InOutQuad).OnComplete(StartFading);
|
||||||
|
|
||||||
|
// 启动血条向上飘动的动画(从初始位置向上移动 `moveDistance` 单位)
|
||||||
|
transform.DOMoveY(initialPosition.y + moveDistance, duration).SetEase(Ease.InOutQuad);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartFading()
|
||||||
|
{
|
||||||
|
// 如果fadeDuration为零,直接销毁
|
||||||
|
if (fadeDuration == 0f)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果fadeDuration大于零,才使用DOTween
|
||||||
|
// 通过DOTween设置透明度渐变到零,动画完成后销毁对象
|
||||||
|
DOTween.ToAlpha(() => rend.material.color, x => rend.material.color = x, 0f, fadeDuration).OnComplete(() =>
|
||||||
|
{
|
||||||
|
Destroy(gameObject); // 动画完成后销毁对象
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
meng_yao/Assets/Prefabs/charatar/enemy/SnowHpControl.cs.meta
Normal file
11
meng_yao/Assets/Prefabs/charatar/enemy/SnowHpControl.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0ecc64720440ac541bd28a5c78ad2250
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,5 +1,96 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1835563174130369000
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4233861956062694457}
|
||||||
|
- component: {fileID: 1105083700936425670}
|
||||||
|
- component: {fileID: 6236648196338733329}
|
||||||
|
- component: {fileID: 8183681752576905587}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Image
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4233861956062694457
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1835563174130369000}
|
||||||
|
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:
|
||||||
|
- {fileID: 4868537472617793602}
|
||||||
|
m_Father: {fileID: 5609612011295970173}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: -10, y: 448.8}
|
||||||
|
m_SizeDelta: {x: -0.8, y: -1743.8}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &1105083700936425670
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1835563174130369000}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &6236648196338733329
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1835563174130369000}
|
||||||
|
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: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 0
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 0
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 21300000, guid: 5e14679cd4ec7054ca57ad1836d91a11, type: 3}
|
||||||
|
m_Type: 3
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 0
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!114 &8183681752576905587
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1835563174130369000}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_ShowMaskGraphic: 1
|
||||||
--- !u!1 &4703411402065954783
|
--- !u!1 &4703411402065954783
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -36,6 +127,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4703411402469012868}
|
- {fileID: 4703411402469012868}
|
||||||
- {fileID: 4703411402842800735}
|
- {fileID: 4703411402842800735}
|
||||||
|
- {fileID: 5609612011295970173}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -66,6 +158,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
moveSpeed: 1
|
moveSpeed: 1
|
||||||
|
obj: {fileID: 4703411402842800732}
|
||||||
--- !u!114 &4703411402755586929
|
--- !u!114 &4703411402755586929
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -83,6 +176,10 @@ MonoBehaviour:
|
|||||||
id: 0
|
id: 0
|
||||||
camp: 1
|
camp: 1
|
||||||
hp: 100
|
hp: 100
|
||||||
|
dieIndex: 1
|
||||||
|
Hpfiil: {fileID: 6236648196338733329}
|
||||||
|
HpTextPrefab: {fileID: 6292166076641120080, guid: 4a7236e471dd72b4299671c7330ec483, type: 3}
|
||||||
|
_Canvas: {fileID: 4205844203331515742}
|
||||||
gold: 10
|
gold: 10
|
||||||
physicalArmor: 10
|
physicalArmor: 10
|
||||||
magicArmor: 5
|
magicArmor: 5
|
||||||
@ -150,6 +247,9 @@ MonoBehaviour:
|
|||||||
isAnimationPlay: 1
|
isAnimationPlay: 1
|
||||||
mycollider: {fileID: 0}
|
mycollider: {fileID: 0}
|
||||||
attackClass: {fileID: 0}
|
attackClass: {fileID: 0}
|
||||||
|
CurrentIndex: 21
|
||||||
|
enemyId:
|
||||||
|
harmNumber: 0
|
||||||
--- !u!210 &6468108308622956862
|
--- !u!210 &6468108308622956862
|
||||||
SortingGroup:
|
SortingGroup:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -326,7 +426,7 @@ SpriteRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_Sprite: {fileID: 21300000, guid: 8d48232a51f3f834ea31963af1692a71, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 221590061d7640c40af0fe198d09af64, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
@ -337,3 +437,181 @@ SpriteRenderer:
|
|||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &6362446851701897971
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5609612011295970173}
|
||||||
|
- component: {fileID: 4205844203331515742}
|
||||||
|
- component: {fileID: 9162732182785843388}
|
||||||
|
- component: {fileID: 8475889323091750017}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: myCanva
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &5609612011295970173
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6362446851701897971}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 0.001, y: 0.001, z: 0.001}
|
||||||
|
m_ConstrainProportionsScale: 1
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 4233861956062694457}
|
||||||
|
m_Father: {fileID: 4703411402065954782}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0.56}
|
||||||
|
m_SizeDelta: {x: 1080, y: 1920}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!223 &4205844203331515742
|
||||||
|
Canvas:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6362446851701897971}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_RenderMode: 2
|
||||||
|
m_Camera: {fileID: 0}
|
||||||
|
m_PlaneDistance: 100
|
||||||
|
m_PixelPerfect: 0
|
||||||
|
m_ReceivesEvents: 1
|
||||||
|
m_OverrideSorting: 0
|
||||||
|
m_OverridePixelPerfect: 0
|
||||||
|
m_SortingBucketNormalizedSize: 0
|
||||||
|
m_VertexColorAlwaysGammaSpace: 0
|
||||||
|
m_AdditionalShaderChannelsFlag: 0
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingOrder: 3
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
--- !u!114 &9162732182785843388
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6362446851701897971}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_UiScaleMode: 0
|
||||||
|
m_ReferencePixelsPerUnit: 100
|
||||||
|
m_ScaleFactor: 1
|
||||||
|
m_ReferenceResolution: {x: 800, y: 600}
|
||||||
|
m_ScreenMatchMode: 0
|
||||||
|
m_MatchWidthOrHeight: 0
|
||||||
|
m_PhysicalUnit: 3
|
||||||
|
m_FallbackScreenDPI: 96
|
||||||
|
m_DefaultSpriteDPI: 96
|
||||||
|
m_DynamicPixelsPerUnit: 1
|
||||||
|
m_PresetInfoIsWorld: 1
|
||||||
|
--- !u!114 &8475889323091750017
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6362446851701897971}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_IgnoreReversedGraphics: 1
|
||||||
|
m_BlockingObjects: 0
|
||||||
|
m_BlockingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
--- !u!1 &7634432846538185418
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4868537472617793602}
|
||||||
|
- component: {fileID: 1847227530155974546}
|
||||||
|
- component: {fileID: 1566038940701374259}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: tianchong
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4868537472617793602
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7634432846538185418}
|
||||||
|
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: 1
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4233861956062694457}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0.11111, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &1847227530155974546
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7634432846538185418}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &1566038940701374259
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7634432846538185418}
|
||||||
|
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: 1, g: 0, b: 0, 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: 98bec0c83aafbd3429a3e26abd709899, type: 3}
|
||||||
|
m_Type: 3
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 0
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
@ -217,6 +217,7 @@ MonoBehaviour:
|
|||||||
id: 0
|
id: 0
|
||||||
camp: 0
|
camp: 0
|
||||||
hp: 100
|
hp: 100
|
||||||
|
dieIndex: -1
|
||||||
gold: 10
|
gold: 10
|
||||||
physicalArmor: 10
|
physicalArmor: 10
|
||||||
magicArmor: 5
|
magicArmor: 5
|
||||||
@ -268,6 +269,8 @@ MonoBehaviour:
|
|||||||
isAnimationPlay: 1
|
isAnimationPlay: 1
|
||||||
mycollider: {fileID: 1338343970434073545}
|
mycollider: {fileID: 1338343970434073545}
|
||||||
attackClass: {fileID: 7276635428522831207}
|
attackClass: {fileID: 7276635428522831207}
|
||||||
|
enemyId:
|
||||||
|
harmNumber: 0
|
||||||
--- !u!61 &-3836672401185760439
|
--- !u!61 &-3836672401185760439
|
||||||
BoxCollider2D:
|
BoxCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -217,6 +217,7 @@ MonoBehaviour:
|
|||||||
id: 0
|
id: 0
|
||||||
camp: 0
|
camp: 0
|
||||||
hp: 100
|
hp: 100
|
||||||
|
dieIndex: -1
|
||||||
gold: 10
|
gold: 10
|
||||||
physicalArmor: 10
|
physicalArmor: 10
|
||||||
magicArmor: 5
|
magicArmor: 5
|
||||||
@ -268,6 +269,8 @@ MonoBehaviour:
|
|||||||
isAnimationPlay: 1
|
isAnimationPlay: 1
|
||||||
mycollider: {fileID: 1338343970434073545}
|
mycollider: {fileID: 1338343970434073545}
|
||||||
attackClass: {fileID: 7276635428522831207}
|
attackClass: {fileID: 7276635428522831207}
|
||||||
|
enemyId:
|
||||||
|
harmNumber: 0
|
||||||
--- !u!61 &-3836672401185760439
|
--- !u!61 &-3836672401185760439
|
||||||
BoxCollider2D:
|
BoxCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -133,6 +133,8 @@ MonoBehaviour:
|
|||||||
role: {fileID: 8433650274028726420}
|
role: {fileID: 8433650274028726420}
|
||||||
attackScope: 3
|
attackScope: 3
|
||||||
damageTyp: 2
|
damageTyp: 2
|
||||||
|
attackCooldown: 1
|
||||||
|
bulltes: []
|
||||||
--- !u!58 &1338343970434073545
|
--- !u!58 &1338343970434073545
|
||||||
CircleCollider2D:
|
CircleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -215,6 +217,7 @@ MonoBehaviour:
|
|||||||
id: 0
|
id: 0
|
||||||
camp: 0
|
camp: 0
|
||||||
hp: 100
|
hp: 100
|
||||||
|
dieIndex: -1
|
||||||
gold: 10
|
gold: 10
|
||||||
physicalArmor: 10
|
physicalArmor: 10
|
||||||
magicArmor: 5
|
magicArmor: 5
|
||||||
@ -286,6 +289,8 @@ MonoBehaviour:
|
|||||||
isAnimationPlay: 1
|
isAnimationPlay: 1
|
||||||
mycollider: {fileID: 1338343970434073545}
|
mycollider: {fileID: 1338343970434073545}
|
||||||
attackClass: {fileID: 7276635428522831207}
|
attackClass: {fileID: 7276635428522831207}
|
||||||
|
enemyId:
|
||||||
|
harmNumber: 0
|
||||||
--- !u!61 &-3836672401185760439
|
--- !u!61 &-3836672401185760439
|
||||||
BoxCollider2D:
|
BoxCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f26a7c194de26b732df00fc752d1f53e167e0693
|
Subproject commit 5e92a0630dc1112bc03996a6b2e56a0cd461ca9d
|
@ -15,9 +15,7 @@ public class enemy : Role
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
harmNumber=value;
|
harmNumber=value;
|
||||||
//Debug.Log(Id+"造成了"+ value+ "伤害");
|
|
||||||
Debug.Log(enemyId+"总伤害"+ harmNumber );
|
Debug.Log(enemyId+"总伤害"+ harmNumber );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,67 +43,20 @@ public class enemy : Role
|
|||||||
|
|
||||||
public override void die()
|
public override void die()
|
||||||
{
|
{
|
||||||
|
base.die();
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 将当前敌人对象放入死亡池
|
// 将当前敌人对象放入死亡池
|
||||||
if (SpawnPool.intance != null)
|
if (SpawnPool.intance != null )
|
||||||
{
|
{
|
||||||
SkillBox.instance.UpdataExp(10);
|
SkillBox.instance.UpdataExp(10);
|
||||||
SpawnPool.intance.ReturnEnemyToPool(this.gameObject); // 回收当前敌人到池中
|
|
||||||
ResetAllStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UIContorl.instance.Killnumber += 1;
|
UIContorl.instance.Killnumber += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 重置角色所有状态
|
|
||||||
/// </summary>
|
|
||||||
public void ResetAllStatus()
|
|
||||||
{
|
|
||||||
// 重置血量
|
|
||||||
Hp = 100f;
|
|
||||||
|
|
||||||
// 重置攻击力
|
|
||||||
Attack = 10f;
|
|
||||||
|
|
||||||
// 重置护甲
|
|
||||||
physicalArmor = 10;
|
|
||||||
magicArmor = 5;
|
|
||||||
|
|
||||||
// 重置等级
|
|
||||||
Level = 1;
|
|
||||||
|
|
||||||
// 重置金币
|
|
||||||
Gold = 10f;
|
|
||||||
|
|
||||||
// 清空 Buff 列表
|
|
||||||
buffList.Clear();
|
|
||||||
|
|
||||||
// 如果有导航组件,停止当前的导航行为
|
|
||||||
if (Navigation != null)
|
|
||||||
{
|
|
||||||
//Navigation.Stop(); // 假设你有 Stop 方法来停止导航
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重置角色动画
|
|
||||||
animationHighlight = 0;
|
|
||||||
isAnimationPlay = false;
|
|
||||||
|
|
||||||
// 重置碰撞体(根据需求是否需要调整)
|
|
||||||
if (mycollider != null)
|
|
||||||
{
|
|
||||||
mycollider.enabled = true; // 启用碰撞体
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 如果有其他需要重置的状态,可以在这里添加
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void OnTriggerEnter2D(Collider2D collision)
|
private void OnTriggerEnter2D(Collider2D collision)
|
||||||
|
Loading…
Reference in New Issue
Block a user