Beispiel #1
0
        public override void BuildBehaviourTree(StateMachine stateMachine)
        {
            machine = stateMachine;
            enemy   = machine as Enemy1;

            waitTimeEvaluateDeltaTime = new WaitForSeconds(evaluateDeltaTime);

            goClosePos_2 = new Sequence(new List <Node>
            {
                actionMove_2
            });
            goFarPos_1 = new Sequence(new List <Node>
            {
                checkIsDistance_1,
                checkIsThereObstacle_1,
                checkPathCornerCount_1,
                actionMove_1
            });
            rootNode = new Selector(new List <Node>
            {
                goFarPos_1,
                goClosePos_2
            });

            checkIsDistance_1.StartLeaf(this);
            checkIsThereObstacle_1.StartLeaf(this);
            checkPathCornerCount_1.StartLeaf(this);
            actionMove_1.StartLeaf(this);

            actionMove_2.StartLeaf(this);
        }
        public override void BuildBehaviourTree(StateMachine stateMachine)
        {
            machine = stateMachine;
            enemy   = machine as Enemy2;

            waitForApproach_3 = new Sequence(new List <Node>
            {
                checkIsDistance1_3,
                checkIsDistance2_3,
                actionMirrorTargetMoves_3
            });
            goToAttackPosition_2 = new Sequence(new List <Node>
            {
                checkIsDistance_2,
                actionGoToAttackPosition_2
            });
            closeAttack_12 = new Sequence(new List <Node>
            {
                checkIsDistance_12,
                actionCloseAttack_12,
                actionPlayIdleAnimation_12,
                actionWaitAfterAttack_12
            });
            dashAttack_11 = new Sequence(new List <Node>
            {
                checkIsDistance1_11,
                checkIsDistance2_11,
                actionDashAttack_11,
                actionPlayAttackEnd_11,
                actionPlayIdleAnimation_11,
                actionWaitAfterAttack_11
            });
            approachAttack_1 = new Selector(new List <Node>
            {
                dashAttack_11,
                closeAttack_12
            });
            rootNode = new Selector(new List <Node>
            {
                approachAttack_1,
                goToAttackPosition_2,
                waitForApproach_3
            });

            checkIsDistance1_11.StartLeaf(this);
            checkIsDistance2_11.StartLeaf(this);
            actionDashAttack_11.StartLeaf(this);
            actionPlayAttackEnd_11.StartLeaf(this);
            actionPlayIdleAnimation_11.StartLeaf(this);
            actionWaitAfterAttack_11.StartLeaf(this);

            checkIsDistance_12.StartLeaf(this);
            actionCloseAttack_12.StartLeaf(this);
            actionPlayIdleAnimation_12.StartLeaf(this);
            actionWaitAfterAttack_12.StartLeaf(this);

            checkIsDistance_2.StartLeaf(this);
            actionGoToAttackPosition_2.StartLeaf(this);

            checkIsDistance1_3.StartLeaf(this);
            checkIsDistance2_3.StartLeaf(this);
            actionMirrorTargetMoves_3.StartLeaf(this);
        }