Exemple #1
0
        protected override INode CreateTree()
        {
            var context = (EnemyBehaviourTreeContext)_context;
            var ability = context.Self.GetAbilityManager().Get(AbilityType.JUMP_ATTACK);

            var hold = new HoldNode();

            var isJumpAttackOnCooldown = new IsAbilityOnCooldownNode(AbilityType.JUMP_ATTACK);
            var seqCooldownHold        = new Sequence("CooldownHoldSequence", isJumpAttackOnCooldown, hold);

            var isTargetInRangeForAttack = new IsTargetInRangeNode(ability.Range);
            var activateJumpAttack       = new ActivateAbilityNode(AbilityType.JUMP_ATTACK);
            var seqJumpAttack            = new Sequence("JumpAttackSequence", isTargetInRangeForAttack, activateJumpAttack);

            var isTargetInRangeForChase = new IsTargetInRangeNode(context.Self.GetAttributeManager().ValueOf(AttributeType.Vision));
            var lockOnTarget            = new LockOnTargetNode();
            var run      = new RunNode();
            var seqChase = new Sequence("ChaseSequence", isTargetInRangeForChase, lockOnTarget, run);

            var selector = new Selector("JumpAttackSelector",
                                        new Inverter(new HasTarget()),
                                        seqCooldownHold,
                                        seqJumpAttack,
                                        seqChase,
                                        hold);

            var repeater = new Repeater(selector);

            return(repeater);
        }
Exemple #2
0
        protected override INode CreateTree()
        {
            var doNothing = new DoNothingNode();

            var lockOn = new LockOnTargetNode();

            var checkDistanceForHold = new IsArrivedToDestinationNode(2f);
            var hold = new HoldNode();
            var seqCheckDistanceHold = new Sequence("MoveSequence", lockOn, checkDistanceForHold, hold);

            var move = new WalkNode();

            var selector = new Selector("NothingMoveSelector", doNothing, seqCheckDistanceHold, move);

            var repeater = new Repeater(selector);

            return(repeater);
        }