You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.6 KiB
C#
124 lines
3.6 KiB
C#
|
2 years ago
|
using UnityEngine;
|
||
|
|
using Bolt;
|
||
|
|
|
||
|
|
namespace Game
|
||
|
|
{
|
||
|
|
[UnitTitle("设置目标")]
|
||
|
|
[UnitSubtitle("NodeSetTarget")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeSetTarget : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueInput target;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
target = ValueInput<int>("target");
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var e = data.Entity;
|
||
|
|
var t = flow.GetValue<int>(target);
|
||
|
|
Util.GetEntity(e).SetTarget(t);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
[UnitTitle("获取难度等级")]
|
||
|
|
[UnitSubtitle("NodeGetDifficulty")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeGetDifficulty : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueOutput difficulty;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
difficulty = ValueOutput<int>("difficulty");
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var d = Util.GetDifficulty();
|
||
|
|
flow.SetValue(difficulty, d);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
[UnitTitle("设置思考频率")]
|
||
|
|
[UnitSubtitle("NodeSetThinkCD")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeSetThinkCD : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueInput cd;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
cd = ValueInput<float>("cd", 1);
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var e = data.Entity;
|
||
|
|
var t = flow.GetValue<float>(cd);
|
||
|
|
Util.SetThinkCd(e, t);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
[UnitTitle("设置饥饿值基础配置")]
|
||
|
|
[UnitSubtitle("NodeHungryBasic")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeHungryBasic : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueInput max;
|
||
|
|
public ValueInput now;
|
||
|
|
public ValueInput inc;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
max = ValueInput<float>("max", 1);
|
||
|
|
now = ValueInput<float>("now", 0);
|
||
|
|
inc = ValueInput<float>("inc", 0);
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var e = data.Entity;
|
||
|
|
var m = flow.GetValue<float>(max);
|
||
|
|
var n = flow.GetValue<float>(now);
|
||
|
|
var i = flow.GetValue<float>(inc);
|
||
|
|
Util.SetHungryBasic(e, m, n, i);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
[UnitTitle("设置饥饿值自增倍率")]
|
||
|
|
[UnitSubtitle("NodeHungryIncreaseRate")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeHungryIncreaseRate : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueInput rate;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
rate = ValueInput<float>("rate", 0);
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var e = data.Entity;
|
||
|
|
var r = flow.GetValue<float>(rate);
|
||
|
|
Util.SetHungryIncreaseRate(e, r);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
[UnitTitle("释放技能")]
|
||
|
|
[UnitSubtitle("NodeCastSkill")]
|
||
|
|
[UnitCategory("Game-AI")]
|
||
|
|
public class NodeCastSkill : NodeDefault
|
||
|
|
{
|
||
|
|
public ValueInput skill;
|
||
|
|
public ValueInput dir;
|
||
|
|
protected override void Def()
|
||
|
|
{
|
||
|
|
skill = ValueInput<int>("skill", 0);
|
||
|
|
dir = ValueInput<Vector3>("dir");
|
||
|
|
}
|
||
|
|
protected override void Run(Flow flow)
|
||
|
|
{
|
||
|
|
var e = data.Entity;
|
||
|
|
var s = flow.GetValue<int>(skill);
|
||
|
|
var d = flow.GetValue<Vector3>(dir);
|
||
|
|
var ett = Util.GetEntity(e);
|
||
|
|
if (ett == null)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
Util.CastSkillMonster(Util.GetEntity(e), s, d);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|