From 4b6941d72b172d6b248c4c3d6e0e6196375d79e4 Mon Sep 17 00:00:00 2001
From: GL <2365963573@qq.com>
Date: Tue, 24 Dec 2024 10:30:02 +0800
Subject: [PATCH] add
---
Role/Bullet.cs | 6 +++++-
Role/Fun.cs | 26 ++++++++++----------------
Role/Role.cs | 13 +++++++++----
3 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/Role/Bullet.cs b/Role/Bullet.cs
index 73d8282..8402e5e 100644
--- a/Role/Bullet.cs
+++ b/Role/Bullet.cs
@@ -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)//子弹打到敌人左边,飘字显示到右边
diff --git a/Role/Fun.cs b/Role/Fun.cs
index a0c723c..d4d8780 100644
--- a/Role/Fun.cs
+++ b/Role/Fun.cs
@@ -84,20 +84,7 @@ public class Fun : Base
}
- ///
- /// 火焰伤害后眩晕效果
- ///
- 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.");
- }
- }
+
///
/// 创建一个减速(眩晕) Buff
@@ -106,14 +93,21 @@ public class Fun : Base
/// 触发概率(0到1之间)
public Action 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
{
diff --git a/Role/Role.cs b/Role/Role.cs
index 5f2ae79..e5373ee 100644
--- a/Role/Role.cs
+++ b/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().direction = HurtDirectin;
go.GetComponent().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> buffs, Action buffAction)
{
buffs.Add(buffAction);
+ Debug.LogError(this.name + "添加buff到"+ buffs);
}
///
@@ -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();
}
///