Merge branch 'main' of http://shu.sheziwanglo.cn:3000/shurongsen/Cute_demon_attacks
This commit is contained in:
commit
06c24cd887
@ -1,5 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class SnowHpControl : MonoBehaviour
|
public class SnowHpControl : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -7,7 +8,7 @@ public class SnowHpControl : MonoBehaviour
|
|||||||
public Vector3 maxScale = new Vector3(1.5f, 1.5f, 1f); // 最大缩放
|
public Vector3 maxScale = new Vector3(1.5f, 1.5f, 1f); // 最大缩放
|
||||||
public float duration = 1f; // 动画的总持续时间
|
public float duration = 1f; // 动画的总持续时间
|
||||||
public float moveDistance = 5f; // 跳跃的水平距离
|
public float moveDistance = 5f; // 跳跃的水平距离
|
||||||
public float fadeDuration = 1f; // 消失时间
|
public float fadeDuration = 0.5f; // 消失时间
|
||||||
public Canvas targetCanvas; // 目标画布,用于确保UI元素在该画布上移动
|
public Canvas targetCanvas; // 目标画布,用于确保UI元素在该画布上移动
|
||||||
|
|
||||||
private Renderer rend; // 用于获取物体的Renderer来控制透明度
|
private Renderer rend; // 用于获取物体的Renderer来控制透明度
|
||||||
@ -46,20 +47,21 @@ public class SnowHpControl : MonoBehaviour
|
|||||||
Sequence sequence = DOTween.Sequence();
|
Sequence sequence = DOTween.Sequence();
|
||||||
|
|
||||||
// 1. 跳跃并逐渐变大
|
// 1. 跳跃并逐渐变大
|
||||||
sequence.Append(transform.DOJump(new Vector3(initialPosition.x + randomX + moveDistance, initialPosition.y+randomY),0.3f,1, 1f)
|
sequence.Append(transform.DOJump(new Vector3(initialPosition.x + randomX + moveDistance, initialPosition.y+randomY),0.3f,1, 0.5f)
|
||||||
.SetEase(Ease.OutQuad) // 跳跃效果,使用OutQuad让跳跃过程中速度逐渐变慢
|
.SetEase(Ease.OutQuad) // 跳跃效果,使用OutQuad让跳跃过程中速度逐渐变慢
|
||||||
);
|
);
|
||||||
//sequence.Join(transform.DOMoveY(initialPosition.y -( randomY + moveDistance) / 2f, 0.6f)
|
//sequence.Join(transform.DOMoveY(initialPosition.y -( randomY + moveDistance) / 2f, 0.6f)
|
||||||
// .SetEase(Ease.OutQuad) // 跳跃的高度,跟X轴的跳跃配合
|
// .SetEase(Ease.OutQuad) // 跳跃的高度,跟X轴的跳跃配合
|
||||||
//);
|
//);
|
||||||
sequence.Join(transform.DOScale(maxScale, 1f) // 同时控制大小,从初始值到最大值
|
sequence.Join(transform.DOScale(maxScale, 0.5f) // 同时控制大小,从初始值到最大值
|
||||||
.SetEase(Ease.OutBack) // 使用OutBack让物体变大时有一个“弹跳”的效果
|
.SetEase(Ease.OutBack) // 使用OutBack让物体变大时有一个“弹跳”的效果
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2. 动画完成后,逐渐变淡并销毁
|
// 2. 动画完成后,逐渐变淡并销毁
|
||||||
sequence.Append(transform.DOScale(new Vector3(0.4f, 0.4f, 0.4f), 0.5f).SetEase(Ease.Linear)); // 缩小效果,模拟消失的感觉
|
sequence.Append(transform.DOScale(Vector3.zero, 0.5f).SetEase(Ease.Linear)); // 缩小效果,模拟消失的感觉
|
||||||
sequence.Append(transform.GetComponent<Renderer>().material.DOFade(0f, fadeDuration).OnComplete(() =>
|
sequence.Append(transform.GetComponent<Text>().DOFade(0f, fadeDuration).OnComplete(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
Destroy(gameObject); // 动画完成后销毁对象
|
Destroy(gameObject); // 动画完成后销毁对象
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,15 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 7467116312563346090}
|
||||||
- {fileID: 4868537472617793602}
|
- {fileID: 4868537472617793602}
|
||||||
m_Father: {fileID: 5609612011295970173}
|
m_Father: {fileID: 5609612011295970173}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: -10, y: 448.8}
|
m_AnchoredPosition: {x: -9.700012, y: 448.8}
|
||||||
m_SizeDelta: {x: -0.8, y: -1743.8}
|
m_SizeDelta: {x: 19.4, y: -1743.8}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &1105083700936425670
|
--- !u!222 &1105083700936425670
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@ -61,7 +62,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
m_Color: {r: 0, g: 0, b: 0, a: 0.8}
|
||||||
m_RaycastTarget: 0
|
m_RaycastTarget: 0
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 0
|
m_Maskable: 0
|
||||||
@ -91,6 +92,82 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_ShowMaskGraphic: 1
|
m_ShowMaskGraphic: 1
|
||||||
|
--- !u!1 &4183642663284617997
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7467116312563346090}
|
||||||
|
- component: {fileID: 744592432927293251}
|
||||||
|
- component: {fileID: 605146830908541898}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: tianchongYello
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &7467116312563346090
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4183642663284617997}
|
||||||
|
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: 5.81, y: 0}
|
||||||
|
m_SizeDelta: {x: 11.72, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &744592432927293251
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4183642663284617997}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &605146830908541898
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4183642663284617997}
|
||||||
|
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: 0.5019608}
|
||||||
|
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: be7cd7587e113e04c886efa8d506cf14, 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!1 &4394176608275501679
|
--- !u!1 &4394176608275501679
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -253,7 +330,8 @@ MonoBehaviour:
|
|||||||
camp: 1
|
camp: 1
|
||||||
hp: 100
|
hp: 100
|
||||||
dieIndex: 1
|
dieIndex: 1
|
||||||
Hpfiil: {fileID: 6236648196338733329}
|
Hpfiil: {fileID: 1566038940701374259}
|
||||||
|
HpfiilYello: {fileID: 605146830908541898}
|
||||||
HpTextPrefab: {fileID: 6292166076641120080, guid: 4a7236e471dd72b4299671c7330ec483, type: 3}
|
HpTextPrefab: {fileID: 6292166076641120080, guid: 4a7236e471dd72b4299671c7330ec483, type: 3}
|
||||||
_Canvas: {fileID: 4205844203331515742}
|
_Canvas: {fileID: 4205844203331515742}
|
||||||
spriteRenderers: {fileID: 4703411402842800734}
|
spriteRenderers: {fileID: 4703411402842800734}
|
||||||
@ -326,6 +404,7 @@ MonoBehaviour:
|
|||||||
attackClass: {fileID: 0}
|
attackClass: {fileID: 0}
|
||||||
CurrentIndex: 33
|
CurrentIndex: 33
|
||||||
enemyId:
|
enemyId:
|
||||||
|
moveSpeed: 3
|
||||||
harmNumber: 0
|
harmNumber: 0
|
||||||
--- !u!210 &6468108308622956862
|
--- !u!210 &6468108308622956862
|
||||||
SortingGroup:
|
SortingGroup:
|
||||||
@ -503,7 +582,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: f4576d09b35f51b44b673ff5b732789b, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 72a01706836824e40a2c6e4285bd237f, 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
|
||||||
@ -648,7 +727,7 @@ RectTransform:
|
|||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 1
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4233861956062694457}
|
m_Father: {fileID: 4233861956062694457}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
@ -242,10 +242,12 @@ MonoBehaviour:
|
|||||||
role: {fileID: 8433650274028726420}
|
role: {fileID: 8433650274028726420}
|
||||||
attackScope: 0.5
|
attackScope: 0.5
|
||||||
damageTyp: 2
|
damageTyp: 2
|
||||||
attackCooldown: 2
|
attackCooldown: 10
|
||||||
bulltes: []
|
bulltes: []
|
||||||
animator: {fileID: 8242226501344609213}
|
animator: {fileID: 8242226501344609213}
|
||||||
fireAni: {fileID: 0}
|
fireAni: {fileID: 0}
|
||||||
|
BulletStartPos: {fileID: 0}
|
||||||
|
direction: {x: 0, y: 0}
|
||||||
--- !u!58 &1338343970434073545
|
--- !u!58 &1338343970434073545
|
||||||
CircleCollider2D:
|
CircleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -331,6 +333,7 @@ MonoBehaviour:
|
|||||||
hp: 100
|
hp: 100
|
||||||
dieIndex: -1
|
dieIndex: -1
|
||||||
Hpfiil: {fileID: 0}
|
Hpfiil: {fileID: 0}
|
||||||
|
HpfiilYello: {fileID: 0}
|
||||||
HpTextPrefab: {fileID: 0}
|
HpTextPrefab: {fileID: 0}
|
||||||
_Canvas: {fileID: 0}
|
_Canvas: {fileID: 0}
|
||||||
spriteRenderers: {fileID: 0}
|
spriteRenderers: {fileID: 0}
|
||||||
|
@ -15,6 +15,12 @@ AnimatorController:
|
|||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: Attack
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
@ -36,8 +42,8 @@ AnimatorStateTransition:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions:
|
||||||
- m_ConditionMode: 6
|
- m_ConditionMode: 1
|
||||||
m_ConditionEvent: State
|
m_ConditionEvent: Attack
|
||||||
m_EventTreshold: 1
|
m_EventTreshold: 1
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: 9124064417411800802}
|
m_DstState: {fileID: 9124064417411800802}
|
||||||
@ -112,10 +118,7 @@ AnimatorStateTransition:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions: []
|
||||||
- m_ConditionMode: 6
|
|
||||||
m_ConditionEvent: State
|
|
||||||
m_EventTreshold: 0
|
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: 6374862596792606963}
|
m_DstState: {fileID: 6374862596792606963}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
|
@ -66,8 +66,8 @@ AnimatorStateTransition:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions:
|
||||||
- m_ConditionMode: 6
|
- m_ConditionMode: 1
|
||||||
m_ConditionEvent: State
|
m_ConditionEvent: Attack
|
||||||
m_EventTreshold: 1
|
m_EventTreshold: 1
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: -2194801018154674215}
|
m_DstState: {fileID: -2194801018154674215}
|
||||||
@ -174,6 +174,12 @@ AnimatorController:
|
|||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: Attack
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
@ -216,10 +222,7 @@ AnimatorStateTransition:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions: []
|
||||||
- m_ConditionMode: 6
|
|
||||||
m_ConditionEvent: State
|
|
||||||
m_EventTreshold: 0
|
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: -8831474942015023954}
|
m_DstState: {fileID: -8831474942015023954}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
@ -228,8 +231,8 @@ AnimatorStateTransition:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 1
|
m_ExitTime: 4
|
||||||
m_HasExitTime: 0
|
m_HasExitTime: 1
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f3cad5d509e03c353dd16bfc5e599f39105deb26
|
Subproject commit 2b93b1469921dc657aa3546d0c31ace7748aaee0
|
@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
public class enemy : Role
|
public class enemy : Role
|
||||||
{
|
{
|
||||||
public string enemyId;
|
public string enemyId;
|
||||||
|
[Header("移动速度")] public float moveSpeed;
|
||||||
|
|
||||||
[HideInInspector]
|
[HideInInspector]
|
||||||
public float harmNumber=0;//伤害
|
public float harmNumber=0;//伤害
|
||||||
@ -24,6 +25,8 @@ public class enemy : Role
|
|||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
|
|
||||||
|
// AnimationTree[0].CharacterAnimationFrameInterval =(int)moveSpeed * 4;
|
||||||
|
|
||||||
if (camp == Camp.Enemy)
|
if (camp == Camp.Enemy)
|
||||||
{
|
{
|
||||||
//开始移动
|
//开始移动
|
||||||
@ -38,7 +41,7 @@ public class enemy : Role
|
|||||||
base.Navigation.waypoints = _waypoints;
|
base.Navigation.waypoints = _waypoints;
|
||||||
|
|
||||||
//开始移动
|
//开始移动
|
||||||
Navigation.MoveToNextWaypoint(this.gameObject);
|
Navigation.MoveToNextWaypoint(this.gameObject,moveSpeed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user