This commit is contained in:
wulongxiao 2024-12-25 11:22:39 +08:00
parent 2910125393
commit 50720f393c
3 changed files with 31 additions and 27 deletions

View File

@ -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)//子弹打到敌人左边,飘字显示到右边
{

View File

@ -1,3 +1,4 @@
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
@ -84,35 +85,44 @@ public class Fun : Base
}
/// <summary>
/// 创建一个减速(眩晕 Buff
/// 创建一个眩晕Buff
/// </summary>
/// <param name="duration">眩晕持续时间</param>
/// <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.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}.");
}
};
}
/// <summary>
/// 减速buff
/// </summary>
/// <param name="slowFactor">减速百分比</param>
/// <param name="duration">时间</param>
/// <returns></returns>
public Action<Role> CreateSlowDownBuff(float slowFactor, float duration)
{
return (Role targetRole) =>
{
Debug.LogError(this.name+"减速buff");
targetRole.SlowDown(slowFactor, duration);
};
}
}

View File

@ -207,7 +207,7 @@ public class Role : Fun
}
// 清空 Buff 列表,假设 Buff 是一次性的
//PlayerBuff.Clear();
PlayerBuff.Clear();
}
/// <summary>
@ -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];
}
}
}*/
}