信息显示修改
This commit is contained in:
parent
f9085935d5
commit
5a778abdbc
@ -109,7 +109,7 @@ public class Bullet : MonoBehaviour
|
||||
{
|
||||
direction = 1;
|
||||
}
|
||||
|
||||
|
||||
Crole.bloodLoss(new object[] { Crole, role.Attack + bulletData.attack, attackObj.damageTyp, role },direction);
|
||||
attackObj.bulltes.Remove(this.gameObject);
|
||||
|
||||
@ -143,6 +143,7 @@ public class Bullet : MonoBehaviour
|
||||
|
||||
if (Time.time - lastDamageTime > 1f) // ÿÃë¿ÛÒ»´ÎѪ
|
||||
{
|
||||
|
||||
Crole.bloodLoss(new object[] { Crole, role.Attack + bulletData.attack, attackObj.damageTyp, role });
|
||||
lastDamageTime = Time.time;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public class Fun : Base
|
||||
DamageType damageType = (DamageType)objects[2];
|
||||
Role UserObj = (Role)objects[3];
|
||||
|
||||
|
||||
|
||||
float finalDamage = harm;
|
||||
switch (damageType)
|
||||
|
39
Role/Role.cs
39
Role/Role.cs
@ -69,12 +69,15 @@ public class Role : Fun
|
||||
// 更新血量文本效果
|
||||
if (HpTextPrefab != null && hp < maxHp)
|
||||
{
|
||||
hit();
|
||||
Navigation.StopPathDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
||||
GameObject go = GameObject.Instantiate(HpTextPrefab, _Canvas.transform);
|
||||
go.GetComponent<SnowHpControl>().direction = HurtDirectin;
|
||||
go.GetComponent<SnowHpControl>().CreateText();
|
||||
go.GetComponent<Text>().text = (temp - hp).ToString(); // 显示伤害值
|
||||
FlashRedEffect(); // 血量减少时的红色闪烁效果
|
||||
StopDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
||||
|
||||
|
||||
}
|
||||
// 判断角色是否死亡
|
||||
if (hp <= 0)
|
||||
@ -128,6 +131,9 @@ public class Role : Fun
|
||||
[Header("攻击脚本")] public Attack attackClass;
|
||||
[Header("当前播放图片序列")] public int CurrentIndex;
|
||||
|
||||
public int hitIndex = 2;//受击动画索引
|
||||
public int normalIndex = 0;//移动动画索引
|
||||
public bool isHit=false;//
|
||||
|
||||
public virtual async void Start()
|
||||
{
|
||||
@ -165,12 +171,13 @@ public class Role : Fun
|
||||
{
|
||||
animationHighlight = AnimationTree.Count - 1;
|
||||
}
|
||||
else if (animationHighlight < 0) {
|
||||
else if (animationHighlight < 0)
|
||||
{
|
||||
animationHighlight = 0;
|
||||
}
|
||||
//EditorUtility.SetDirty(this);
|
||||
List<Sprite> LightSprite = AnimationTree[animationHighlight].value;
|
||||
if (LightSprite == null )
|
||||
if (LightSprite == null)
|
||||
{
|
||||
isAnimationPlay = false;
|
||||
return;
|
||||
@ -207,16 +214,23 @@ public class Role : Fun
|
||||
if (lsanimationHighlight == dieIndex)
|
||||
{
|
||||
|
||||
SpawnPool.intance.ReturnEnemyToPool(this.gameObject); // 回收当前敌人到池中
|
||||
ResetAllStatus();
|
||||
SpawnPool.intance.ReturnEnemyToPool(this.gameObject); // 回收当前敌人到池中
|
||||
ResetAllStatus();
|
||||
}
|
||||
|
||||
if (lsanimationHighlight == hitIndex)
|
||||
{
|
||||
|
||||
animationHighlight = normalIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色死亡
|
||||
/// </summary>
|
||||
public virtual void die()
|
||||
public virtual void die()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
@ -227,6 +241,19 @@ public class Role : Fun
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色受到攻击
|
||||
/// </summary>
|
||||
public virtual void hit()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
animationHighlight = hitIndex;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位更新buff
|
||||
/// </summary>
|
||||
|
@ -19,7 +19,7 @@ public class SimplePathfindingDoTween : Fun
|
||||
private int currentWaypointIndex = 0; // 当前路径点的索引
|
||||
Vector3 Vector3 = new Vector3();
|
||||
|
||||
|
||||
public Tween pathTween;
|
||||
|
||||
[Header("旋转的动画")]public GameObject obj;
|
||||
public void MoveToNextWaypoint(GameObject gameObject, float moveSpeed)
|
||||
@ -49,7 +49,7 @@ public class SimplePathfindingDoTween : Fun
|
||||
}
|
||||
|
||||
// 使用DoTween的DOPath来平滑地移动
|
||||
gameObject.transform.DOPath(path, timeToReach, PathType.Linear)
|
||||
pathTween=gameObject.transform.DOPath(path, timeToReach, PathType.Linear)
|
||||
.SetEase(Ease.Linear)
|
||||
.OnUpdate(() => RotateTowardsTarget()); // 每次更新时调整旋转
|
||||
|
||||
@ -64,6 +64,20 @@ public class SimplePathfindingDoTween : Fun
|
||||
// 暂停动画
|
||||
transform.DOPause();
|
||||
}
|
||||
|
||||
|
||||
public void StopPathDoTween(float stopTime)//暂停移动
|
||||
{
|
||||
// 暂停当前的动画
|
||||
pathTween.Pause();
|
||||
|
||||
// 插入一个自定义的延迟(僵直时间)
|
||||
DOTween.To(() => 0f, x => { }, 0f, stopTime).OnKill(() =>
|
||||
{
|
||||
// 在延迟结束后恢复动画
|
||||
pathTween.Play();
|
||||
});
|
||||
}
|
||||
void RotateTowardsTarget()
|
||||
{
|
||||
Vector3 _vector3 = Vector3 - gameObject.transform.position;
|
||||
|
Loading…
Reference in New Issue
Block a user