add
This commit is contained in:
parent
eac4427f5e
commit
4b6941d72b
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
public enum BulletType
|
||||
{
|
||||
@ -124,6 +124,10 @@ public class Bullet : MonoBehaviour
|
||||
{
|
||||
if(Crole.camp!= role.camp)
|
||||
{
|
||||
Crole.PlayerBuff = role.storageBuff.ToList();
|
||||
Crole.ApplyBuffs();
|
||||
|
||||
|
||||
Debug.Log(this.role.gameObject.name+"进行攻击计算");
|
||||
int direction=0;
|
||||
if (collision.transform.position.x>transform.position.x)//子弹打到敌人左边,飘字显示到右边
|
||||
|
26
Role/Fun.cs
26
Role/Fun.cs
@ -84,20 +84,7 @@ public class Fun : Base
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 火焰伤害后眩晕效果
|
||||
/// </summary>
|
||||
public void Deceleration(Role targetAudience, float DecelerationTimer, float probability)
|
||||
{
|
||||
// 随机决定是否触发眩晕效果
|
||||
float temp = UnityEngine.Random.Range(0, 1f);
|
||||
if (temp <= probability)
|
||||
{
|
||||
// 执行眩晕效果
|
||||
targetAudience.Navigation.StopPathDoTween(DecelerationTimer);
|
||||
Debug.Log($"Applied Deceleration for {DecelerationTimer} seconds.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个减速(眩晕) Buff
|
||||
@ -106,14 +93,21 @@ public class Fun : Base
|
||||
/// <param name="probability">触发概率(0到1之间)</param>
|
||||
public Action<Role> CreateDecelerationBuff(float duration, float probability)
|
||||
{
|
||||
Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
return (Role targetRole) =>
|
||||
{
|
||||
Debug.Log("@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
float temp = UnityEngine.Random.Range(0f, 1f);
|
||||
Debug.LogWarning("temp="+temp);
|
||||
Debug.LogWarning("duration="+duration);
|
||||
Debug.LogWarning("probability=" + probability);
|
||||
if (temp <= probability)
|
||||
{
|
||||
// 执行眩晕效果
|
||||
// 执行眩晕效果
|
||||
targetRole.Navigation.StopPathDoTween(duration);
|
||||
Debug.Log($"Applied Deceleration for {duration} seconds to {targetRole.name}.");
|
||||
Debug.LogWarning(targetRole.name + "执行眩晕效果");
|
||||
|
||||
Debug.LogWarning($"Applied Deceleration for {duration} seconds to {targetRole.name}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
13
Role/Role.cs
13
Role/Role.cs
@ -83,7 +83,8 @@ public class Role : Fun
|
||||
if (HpTextPrefab != null && hp < maxHp)
|
||||
{
|
||||
hit();
|
||||
Navigation.StopPathDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
||||
Debug.LogError("僵直效果,被注释了");
|
||||
//Navigation.StopPathDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
||||
GameObject go = GameObject.Instantiate(HpTextPrefab, _Canvas.transform);
|
||||
go.GetComponent<SnowHpControl>().direction = HurtDirectin;
|
||||
go.GetComponent<SnowHpControl>().CreateText();
|
||||
@ -180,7 +181,9 @@ public class Role : Fun
|
||||
tag = Enum.GetName(typeof(Camp), camp);
|
||||
updateAnimation();
|
||||
|
||||
//ApplyBuffs();
|
||||
|
||||
|
||||
//AddBuff(storageBuff,this.CreateDecelerationBuff(10f,1f));
|
||||
}
|
||||
|
||||
|
||||
@ -191,6 +194,7 @@ public class Role : Fun
|
||||
public void AddBuff(List<Action<Role>> buffs, Action<Role> buffAction)
|
||||
{
|
||||
buffs.Add(buffAction);
|
||||
Debug.LogError(this.name + "添加buff到"+ buffs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -200,11 +204,12 @@ public class Role : Fun
|
||||
{
|
||||
foreach (var buff in PlayerBuff)
|
||||
{
|
||||
buff.Invoke(this); // 将自己作为目标传递
|
||||
Debug.LogError(this.name + "执行buff");
|
||||
buff.Invoke(this); // 将自己作为目标传递
|
||||
}
|
||||
|
||||
// 清空 Buff 列表,假设 Buff 是一次性的
|
||||
PlayerBuff.Clear();
|
||||
//PlayerBuff.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user