public override bool Evaluate(BInput _input = null) { TargetInput input = _input as TargetInput; bool b = input.Target.GetProperty("name") == "hero"; return(b); }
public override bool DoEvaluate(BInput _input) { TargetInput input = (TargetInput)_input; float distance = Vector3.Distance(input.owner.Transform.position, input.Target.Transform.position); return(distance < 10.0f); }
/// <summary> /// </summary> /// <param name="_input"></param> /// <returns></returns> public override ResultType Execute(BInput _input) { TargetInput input = (TargetInput)_input; input.owner.Transform.LookAt(input.Target.Transform); return(ResultType.Success); }
public override ResultType Execute(BInput _input) { TargetInput input = _input as TargetInput; input.Target.SetProperty("hp", 100); GameInput.DebugLog("do action atk"); state = State.Exit; return(ResultType.Success); }
private void Init() { //_selectorNode = new SelectorNode(); //_selectorNode = new SequenceNode(); _selectorNode = new ParallelNode(); ParallelNode _subParallel = new ParallelNode(); _actionAtk = new ActionAtk(); _actionAtk.SetPreCondition(new ActionAtkPreCondition()); _selectorNode.AddChild(new ActionIdle()); _selectorNode.AddChild(_actionAtk); TargetInput _input = new TargetInput(); _input.Target = GlobalData.hero.MyEnity; _input.state = 1; _selectorNode.RunNode(_input); GameInput.Instance.OnUpdate += _selectorNode.Update; }
public override bool DoEvaluate(BInput _input) { TargetInput _i = _input as TargetInput; return(_i.state == 1); }