From 50720f393c90b130c39161e96fba56d8fc085b8a Mon Sep 17 00:00:00 2001 From: wulongxiao <2545507770@qq.com> Date: Wed, 25 Dec 2024 11:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Role/Bullet.cs | 13 +++++++++---- Role/Fun.cs | 28 +++++++++++++++++++--------- Role/Role.cs | 17 +++-------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Role/Bullet.cs b/Role/Bullet.cs index 4128962..6e93553 100644 --- a/Role/Bullet.cs +++ b/Role/Bullet.cs @@ -124,11 +124,16 @@ public class Bullet : MonoBehaviour { if(Crole.camp!= role.camp) { - Crole.PlayerBuff = role.storageBuff.ToList(); - Crole.ApplyBuffs(); + foreach (var buff in role.storageBuff) + { + if (!Crole.PlayerBuff.Contains(buff)) + { + Crole.PlayerBuff.Add(buff); + } + } + Crole.ApplyBuffs(); - - Debug.Log(this.role.gameObject.name+"进行攻击计算"); + 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 2910ef7..05d45dc 100644 --- a/Role/Fun.cs +++ b/Role/Fun.cs @@ -1,3 +1,4 @@ +using DG.Tweening; using System; using System.Collections; using System.Collections.Generic; @@ -84,35 +85,44 @@ public class Fun : Base } - /// - /// 创建一个减速(眩晕) Buff + /// 创建一个眩晕Buff /// /// 眩晕持续时间 /// 触发概率(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.LogWarning(targetRole.name + "执行眩晕效果"); - Debug.LogWarning($"应用减速 {duration} 至 {targetRole.name}."); + Debug.LogWarning($"应用眩晕 {duration} 至 {targetRole.name}."); } else { - Debug.Log($"减速buff未触发 on {targetRole.name}."); + Debug.Log($"眩晕buff未触发 on {targetRole.name}."); } }; } + + /// + /// 减速buff + /// + /// 减速百分比 + /// 时间 + /// + public Action CreateSlowDownBuff(float slowFactor, float duration) + { + return (Role targetRole) => + { + Debug.LogError(this.name+"减速buff"); + targetRole.SlowDown(slowFactor, duration); + }; + } } diff --git a/Role/Role.cs b/Role/Role.cs index 2be6115..db37310 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -207,7 +207,7 @@ public class Role : Fun } // 清空 Buff 列表,假设 Buff 是一次性的 - //PlayerBuff.Clear(); + PlayerBuff.Clear(); } /// @@ -494,21 +494,10 @@ public class Role : Fun return num; } - /*void ReadTable() + public virtual void SlowDown(float slowFactor, float duration) { - foreach (Monster character in MengyaoInfo.Instance.m_SkillData) - { - if (id == character.temp_id) - { - Myskill = character.skills[0]; - } - } - - - - - }*/ + }