Beispiel #1
0
        protected override NodeState OnRunning(ExecutionContext context)
        {
            SimpleContext cxt = (SimpleContext)context;

            var actor         = cxt.Actor;
            var scr           = actor.GetComponent <agentType>();
            var conditionType = Bindings.Create(() => scr.type);

            var Child = Children[conditionType.Get()];

            Child.Execute(context);
            return(Child.State);
        }
Beispiel #2
0
        protected override NodeState OnRunning(ExecutionContext context)
        {
            SimpleContext cxt       = (SimpleContext)context;
            var           transform = cxt.Actor.transform;
            Vector3       center    = new Vector3(0, 0, 0);
            var           distance  = Vector3.Distance(transform.position, center);

            if (distance < 51.0f)
            {
                Child.Execute(context);
                return(Child.State);
            }
            else
            {
                return(NodeState.Failure);
            }
        }
Beispiel #3
0
        protected override NodeState OnRunning(ExecutionContext context)
        {
            SimpleContext cxt = (SimpleContext)context;

            var actor     = cxt.Actor;
            var scr       = actor.GetComponent <agentStateController>();
            var condition = Bindings.Create(() => scr.isDying());

            if (condition.Get())
            {
                Child.Execute(context);
                return(Child.State);
            }
            else
            {
                return(NodeState.Failure);
            }
        }