减速
This commit is contained in:
parent
2910125393
commit
50720f393c
@ -124,10 +124,15 @@ public class Bullet : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if(Crole.camp!= role.camp)
|
if(Crole.camp!= role.camp)
|
||||||
{
|
{
|
||||||
Crole.PlayerBuff = role.storageBuff.ToList();
|
foreach (var buff in role.storageBuff)
|
||||||
|
{
|
||||||
|
if (!Crole.PlayerBuff.Contains(buff))
|
||||||
|
{
|
||||||
|
Crole.PlayerBuff.Add(buff);
|
||||||
|
}
|
||||||
|
}
|
||||||
Crole.ApplyBuffs();
|
Crole.ApplyBuffs();
|
||||||
|
|
||||||
|
|
||||||
Debug.Log(this.role.gameObject.name+"进行攻击计算");
|
Debug.Log(this.role.gameObject.name+"进行攻击计算");
|
||||||
int direction=0;
|
int direction=0;
|
||||||
if (collision.transform.position.x>transform.position.x)//子弹打到敌人左边,飘字显示到右边
|
if (collision.transform.position.x>transform.position.x)//子弹打到敌人左边,飘字显示到右边
|
||||||
|
28
Role/Fun.cs
28
Role/Fun.cs
@ -1,3 +1,4 @@
|
|||||||
|
using DG.Tweening;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -85,34 +86,43 @@ public class Fun : Base
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建一个减速(眩晕) Buff
|
/// 创建一个眩晕Buff
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="duration">眩晕持续时间</param>
|
/// <param name="duration">眩晕持续时间</param>
|
||||||
/// <param name="probability">触发概率(0到1之间)</param>
|
/// <param name="probability">触发概率(0到1之间)</param>
|
||||||
public Action<Role> CreateDecelerationBuff(float duration, float probability)
|
public Action<Role> CreateDecelerationBuff(float duration, float probability)
|
||||||
{
|
{
|
||||||
Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
return (Role targetRole) =>
|
return (Role targetRole) =>
|
||||||
{
|
{
|
||||||
Debug.Log("@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
float temp = UnityEngine.Random.Range(0f, 1f);
|
float temp = UnityEngine.Random.Range(0f, 1f);
|
||||||
Debug.LogWarning("temp="+temp);
|
|
||||||
Debug.LogWarning("duration="+duration);
|
|
||||||
Debug.LogWarning("probability=" + probability);
|
|
||||||
if (temp <= probability)
|
if (temp <= probability)
|
||||||
{
|
{
|
||||||
// 执行眩晕效果
|
// 执行眩晕效果
|
||||||
targetRole.Navigation.StopPathDoTween(duration);
|
targetRole.Navigation.StopPathDoTween(duration);
|
||||||
Debug.LogWarning(targetRole.name + "执行眩晕效果");
|
Debug.LogWarning(targetRole.name + "执行眩晕效果");
|
||||||
|
|
||||||
Debug.LogWarning($"应用减速 {duration} 至 {targetRole.name}.");
|
Debug.LogWarning($"应用眩晕 {duration} 至 {targetRole.name}.");
|
||||||
}
|
}
|
||||||
else
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
Role/Role.cs
17
Role/Role.cs
@ -207,7 +207,7 @@ public class Role : Fun
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 清空 Buff 列表,假设 Buff 是一次性的
|
// 清空 Buff 列表,假设 Buff 是一次性的
|
||||||
//PlayerBuff.Clear();
|
PlayerBuff.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -494,22 +494,11 @@ public class Role : Fun
|
|||||||
return num;
|
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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user