眩晕技能技能
This commit is contained in:
parent
992d14d1f9
commit
735255a588
@ -236,10 +236,6 @@ public class Bullet : MonoBehaviour
|
||||
attackObj.bulltes.Remove(this.gameObject);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
68
Role/Fun.cs
68
Role/Fun.cs
@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using Random = System.Random;
|
||||
|
||||
public enum DamageType
|
||||
{
|
||||
@ -29,24 +30,25 @@ public class BUff
|
||||
public Action<object[]> Funaction;//调用的函数
|
||||
public object[] value;//调用函数的值
|
||||
|
||||
public BuffTypeState buffTypeState = 0;
|
||||
|
||||
|
||||
public bool hasfalg(BuffTypeState fag)
|
||||
{
|
||||
return (buffTypeState & fag) == fag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum BuffTypeState
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Fun : Base
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 中毒 //目标 // 自己
|
||||
/// </summary>
|
||||
/// <param name="objects"></param>
|
||||
public void poisoning(object[] objects)
|
||||
{
|
||||
Role targetAudience = (Role)objects[0];
|
||||
Role myPalye = (Role)objects[1];
|
||||
Debug.Log("触发中毒");
|
||||
Debug.Log(myPalye.name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 扣血 传入参数 目标,伤害值,攻击类型,使用者,子弹射来的方向(0是右边,1是左边)
|
||||
/// </summary>
|
||||
@ -57,8 +59,6 @@ public class Fun : Base
|
||||
float harm = (float)objects[1];
|
||||
DamageType damageType = (DamageType)objects[2];
|
||||
Role UserObj = (Role)objects[3];
|
||||
|
||||
|
||||
|
||||
float finalDamage = harm;
|
||||
switch (damageType)
|
||||
@ -84,5 +84,41 @@ 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
|
||||
/// </summary>
|
||||
/// <param name="duration">眩晕持续时间</param>
|
||||
/// <param name="probability">触发概率(0到1之间)</param>
|
||||
public Action<Role> CreateDecelerationBuff(float duration, float probability)
|
||||
{
|
||||
return (Role targetRole) =>
|
||||
{
|
||||
float temp = UnityEngine.Random.Range(0f, 1f);
|
||||
if (temp <= probability)
|
||||
{
|
||||
// 执行眩晕效果
|
||||
targetRole.Navigation.StopPathDoTween(duration);
|
||||
Debug.Log($"Applied Deceleration for {duration} seconds to {targetRole.name}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"Deceleration Buff did not trigger on {targetRole.name}.");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
47
Role/Role.cs
47
Role/Role.cs
@ -111,7 +111,8 @@ public class Role : Fun
|
||||
}
|
||||
[Header("物理护甲")] public int physicalArmor = 10;//物理护甲
|
||||
[Header("魔法护甲")] public int magicArmor = 5;//魔法护甲
|
||||
public List<BUff> buffList = new List<BUff>();
|
||||
|
||||
|
||||
[Header("导航组件")] public SimplePathfindingDoTween Navigation;
|
||||
[System.Serializable ]
|
||||
public class AnimationList//动画list
|
||||
@ -137,6 +138,19 @@ public class Role : Fun
|
||||
public int normalIndex = 0;//移动动画索引
|
||||
public bool isHit=false;//
|
||||
|
||||
public List<BUff> buffList = new List<BUff>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 储存buff
|
||||
/// </summary>
|
||||
public List<Action<Role>> storageBuff = new List<Action<Role>>();
|
||||
|
||||
/// <summary>
|
||||
/// 使用buff
|
||||
/// </summary>
|
||||
public List<Action<Role>> PlayerBuff=new List<Action<Role>>();
|
||||
|
||||
public virtual async void Start()
|
||||
{
|
||||
maxHp = hp;
|
||||
@ -149,13 +163,37 @@ public class Role : Fun
|
||||
attackClass.role = this;
|
||||
}
|
||||
UpdateBuff();
|
||||
//Navigation.MoveToNextWaypoint(gameObject);
|
||||
}
|
||||
tag = Enum.GetName(typeof(Camp), camp);
|
||||
updateAnimation();
|
||||
|
||||
//AttackScope=1f;
|
||||
|
||||
//ApplyBuffs();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加Buff
|
||||
/// </summary>
|
||||
/// <param name="buffAction"></param>
|
||||
public void AddBuff(List<Action<Role>> buffs, Action<Role> buffAction)
|
||||
{
|
||||
buffs.Add(buffAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行所有当前 Buff
|
||||
/// </summary>
|
||||
public void ApplyBuffs()
|
||||
{
|
||||
foreach (var buff in PlayerBuff)
|
||||
{
|
||||
buff.Invoke(this); // 将自己作为目标传递
|
||||
}
|
||||
|
||||
// 清空 Buff 列表,假设 Buff 是一次性的
|
||||
PlayerBuff.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色动画更新
|
||||
/// </summary>
|
||||
@ -177,7 +215,6 @@ public class Role : Fun
|
||||
{
|
||||
animationHighlight = 0;
|
||||
}
|
||||
//EditorUtility.SetDirty(this);
|
||||
List<Sprite> LightSprite = AnimationTree[animationHighlight].value;
|
||||
if (LightSprite == null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user