private void _BuildNode() { var th = new TurnHandler(_Behavior); float angle = 0.0f; var builder = new Regulus.BehaviourTree.Builder(); _Node = builder.Sequence() .Action( (delta) => { var result = _Behavior.GetTargetAngle(_Target, ref angle); th.Input(angle); return(result); }) .Action((delta) => th.Run(delta)) .Not() .Sequence() .Action((delta) => _Not(_Behavior.CheckDistance(_Target, _Distance))) .Action(_Behavior.MoveForward) .End() .End() .Action((delta) => _Behavior.GetTargetAngle(_Target, ref angle)) .Action((delta) => _Behavior.CheckAngle(angle)) .Action(_Behavior.StopMove) .End().Build(); }
private ITicker _CollisionWayfindingStrategy() { var th = new TurnHandler(this); var builder = new Regulus.BehaviourTree.Builder(); return(builder .Sequence() .Action( (delta) => { var result = _CheckCollide(); th.Input(Regulus.Utility.Random.Instance.NextFloat(1, 360)); return result; }) .Action((delta) => th.Run(delta)) .Action(_MoveForward) .Action(() => new WaitSecondStrategy(0.5f), t => t.Tick, t => t.Start, t => t.End) .End() .Build()); }
private ITicker _InvestigateStrategy() { var th = new TurnHandler(this); var builder = new Regulus.BehaviourTree.Builder(); var node = builder .Sequence() .Action(_NotEnemy) .Action(_NeedInvestigate) .Action( (delta) => { var angel = Regulus.Utility.Random.Instance.NextFloat(135, 225); th.Input(angel); return(TICKRESULT.SUCCESS); }) .Action((delta) => { if (GetTrunSpeed() > 0) { return(th.Run(delta)); } return(TICKRESULT.FAILURE); }) .Action((delta) => _Talk("?")) .Action(_DoneInvestigate) .End() .Build(); return(node); }
private ITicker _InvestigateStrategy() { var th = new TurnHandler(this); var builder = new Regulus.BehaviourTree.Builder(); var node = builder .Sequence() .Action(_NotEnemy) .Action(_NeedInvestigate ) .Action( (delta) => { var angel = Regulus.Utility.Random.Instance.NextFloat(135, 225); th.Input(angel); return TICKRESULT.SUCCESS; }) .Action((delta) => { if (GetTrunSpeed() > 0) { return th.Run(delta); } return TICKRESULT.FAILURE; }) .Action((delta) => _Talk("?")) .Action(_DoneInvestigate) .End() .Build(); return node; }
private ITicker _CollisionWayfindingStrategy() { var th = new TurnHandler(this); var builder = new Regulus.BehaviourTree.Builder(); return builder .Sequence() .Action( (delta) => { var result = _CheckCollide(); th.Input(Regulus.Utility.Random.Instance.NextFloat(1, 360)); return result; } ) .Action((delta) => th.Run(delta)) .Action(_MoveForward) .Action(()=>new WaitSecondStrategy(0.5f)) .End() .Build(); }