The base sequence class. This will execute each branch of logic, in order. If all branches succeed, this composite will return a successful run status. If any branch fails, this composite will return a failed run status.
Inheritance: GroupComposite
Exemplo n.º 1
0
        public Sequence this[Bot owner]
        {
            get
            {
                var seq = new Sequence(
                    
                    //first we must have a valid target
                    new Decorator(ret => Helpers.hasValidTarget(owner), new TreeSharp.Action(ret => RunStatus.Success)),

                    //if we are already busy, don't continue.
                    new Decorator(ret => !Helpers.isInAction(owner), new TreeSharp.Action(ret => RunStatus.Success)),

                    //send the attack action.
                    new TreeSharp.Action(ret =>
                    {
                        owner.Attack(owner.CurrentTarget.Value);
                    }),

                    //wait for the action to complete (or we time out).
                    new Wait(1, ret => Helpers.isInAction(owner) , new TreeSharp.Action(ret => RunStatus.Success))
            );

            return seq;

            }
        
        }            
Exemplo n.º 2
0
        public Sequence this[IBot.IBot bot]
        {
            get
            {
                var seq = new Sequence(

                    new Decorator(ret => bot.isRunning, new TreeSharp.Action(ret => RunStatus.Success)),
                    
                    //first we must have a valid target
                    new Decorator(ret => Util.Targeting.HasValidTarget(bot.CurrentTarget), new TreeSharp.Action(ret => RunStatus.Success)),

                    //if we are already busy, don't continue.
                    new Decorator(ret => !bot.isInAction, new TreeSharp.Action(ret => RunStatus.Success)),


                    //send the attack action.
                    new TreeSharp.Action(ret =>
                    {
                        bot.Attack(bot.CurrentTarget);
                    }),

                    //wait for the action to complete (or we time out).
                    new Wait(1, ret => bot.isInAction, new TreeSharp.Action(ret => RunStatus.Success))
            );

                return seq;

            }

        }
Exemplo n.º 3
0
        public Sequence this[Bot owner]
        {
            get
            {
                var seq = new Sequence(

                //first we must not already have a target.
                new Decorator(ret => !Helpers.hasValidTarget(owner), new TreeSharp.Action(ret => RunStatus.Success)),

                //go grab a target
                new TreeSharp.Action(ret =>
                {
                    owner.CurrentTarget = Helpers.getNearestEnemy();
                })

            );

            return seq;

            }
        
        }        
        public Sequence this[IBot.IBot bot]
        {
            get
            {
                var seq = new Sequence(

                    new Decorator(ret => bot.isRunning, new TreeSharp.Action(ret => RunStatus.Success)),


                    new Decorator(ret => bot.CurrentTarget.Distance() > 50, new TreeSharp.Action(ret => RunStatus.Success)),

                    new TreeSharp.Action(ret =>
                    {
                        Util.MoveTo.MoveToPosWithNavMeshAsync(bot.CurrentTarget.ToSharpDXVector3());
                    }),

                    new Wait(1, ret => bot.isInAction, new TreeSharp.Action(ret => RunStatus.Success))
                );

                return seq;

            }

        }
Exemplo n.º 5
0
        public Sequence this[IBot.IBot bot]
        {
            get
            {
                var seq = new Sequence(

                    new Decorator(ret => bot.isRunning, new TreeSharp.Action(ret => RunStatus.Success)),

                    //first we must not already have a target.
                    new Decorator(ret => !Util.Targeting.HasValidTarget(bot.CurrentTarget), new TreeSharp.Action(ret => RunStatus.Success)),

                    //go grab a target
                    new TreeSharp.Action(ret =>
                    {
                        bot.CurrentTarget = Util.Targeting.GetTarget();
                    })

                );

                return seq;

            }

        }