public NodeResult Execute(BehaviourTreeAgent agent) { var closest = locator.AtPosition(brain.Position, brain.LookDistance).OfType <RobotPlayerPart>().FirstOrDefault(); // Use sensory information instead of lookup? brain.TargetPlayer = closest; return(NodeResult.Success); }
public bool CanExecute(BehaviourTreeAgent agent) { brain.TargetItem = null; //WARNING: probably a bad idea this line is return(locator.AtPosition(brain.Position, range).OfType <ItemPart>().Any()); }