示例#1
0
    void BuildBehaviorTree()
    {
        MySelectorNode rootSelector  = new MySelectorNode();
        MySequenceNode sequenceNode1 = new MySequenceNode();
        MySequenceNode sequenceNode2 = new MySequenceNode();
        MySequenceNode sequenceNode3 = new MySequenceNode();
        MySequenceNode sequenceNode4 = new MySequenceNode();
        MySelectorNode selectorNode1 = new MySelectorNode();

        StageOneDone                stageOneDone                = new StageOneDone(this);
        StageOneIsNotDone           stageOneIsNotDone           = new StageOneIsNotDone(this);
        StageTwoDone                stageTwoDone                = new StageTwoDone(this);
        StageTwoIsNotDone           stageTwoIsNotDone           = new StageTwoIsNotDone(this);
        StageThreeIsNotDone         stageThreeIsNotDone         = new StageThreeIsNotDone(this);
        Enraged                     enraged                     = new Enraged(this);
        SprayBulletsTimerAtZeroNode sprayBulletsTimerAtZeroNode = new SprayBulletsTimerAtZeroNode(this);
        SprayBulletsNode            sprayBulletsNode            = new SprayBulletsNode(this);
        SpawnEnemyTimerAtZeroNode   spawnEnemyTimerAtZeroNode   = new SpawnEnemyTimerAtZeroNode(this);
        SpawnEnemiesNode            spawnEnemiesNode            = new SpawnEnemiesNode(this);
        PlayerNearBossNode          playerNearBossNode          = new PlayerNearBossNode(this);
        BodySlamNode                bodySlamNode                = new BodySlamNode(this);
        ShootAtPlayerBossNode       shootAtPlayerBossNode       = new ShootAtPlayerBossNode(this);

        sequenceNode1.add_kid(stageOneIsNotDone);
        sequenceNode1.add_kid(enraged);
        sequenceNode1.add_kid(sprayBulletsTimerAtZeroNode);
        sequenceNode1.add_kid(sprayBulletsNode);

        sequenceNode2.add_kid(stageOneDone);
        sequenceNode2.add_kid(stageTwoIsNotDone);
        sequenceNode2.add_kid(enraged);
        sequenceNode2.add_kid(spawnEnemyTimerAtZeroNode);
        sequenceNode2.add_kid(spawnEnemiesNode);

        sequenceNode3.add_kid(stageTwoDone);
        sequenceNode3.add_kid(stageThreeIsNotDone);
        sequenceNode3.add_kid(enraged);
        sequenceNode3.add_kid(sprayBulletsTimerAtZeroNode);
        sequenceNode3.add_kid(sprayBulletsNode);
        sequenceNode3.add_kid(spawnEnemyTimerAtZeroNode);
        sequenceNode3.add_kid(spawnEnemiesNode);

        sequenceNode4.add_kid(playerNearBossNode);
        sequenceNode4.add_kid(bodySlamNode);

        selectorNode1.add_kid(sequenceNode4);
        selectorNode1.add_kid(shootAtPlayerBossNode);

        rootSelector.add_kid(sequenceNode1);
        rootSelector.add_kid(sequenceNode2);
        rootSelector.add_kid(sequenceNode3);
        rootSelector.add_kid(selectorNode1);

        behavior = new MyBehaviorTree(rootSelector);
    }
示例#2
0
    void BuildBehaviorTree()
    {
        MySelectorNode rootSelector  = new MySelectorNode();
        MySequenceNode sequenceNode1 = new MySequenceNode();
        MySequenceNode sequenceNode2 = new MySequenceNode();
        CheckIfPlayerIsNearEnemyLevel2Node checkIfPlayerIsNearEnemyLevel2Node = new CheckIfPlayerIsNearEnemyLevel2Node(this);
        ShootAtPlayerNode        shootAtPlayerNode        = new ShootAtPlayerNode(this);
        TimerAtZeroNode          timerAtZeroNode          = new TimerAtZeroNode(this);
        ShootInAllDirectionsNode shootInAllDirectionsNode = new ShootInAllDirectionsNode(this);

        sequenceNode1.add_kid(checkIfPlayerIsNearEnemyLevel2Node);
        sequenceNode1.add_kid(shootAtPlayerNode);
        sequenceNode2.add_kid(timerAtZeroNode);
        sequenceNode2.add_kid(shootInAllDirectionsNode);
        rootSelector.add_kid(sequenceNode1);
        rootSelector.add_kid(sequenceNode2);

        behavior = new MyBehaviorTree(rootSelector);
    }
示例#3
0
    void BuildBehaviorTree()
    {
        MySelectorNode rootSelector  = new MySelectorNode();
        MySequenceNode sequenceNode1 = new MySequenceNode();
        MySequenceNode sequenceNode2 = new MySequenceNode();
        CheckIfPlayerIsNearEnemyLevel1Node checkIfPlayerIsNearEnemyLevel1Node = new CheckIfPlayerIsNearEnemyLevel1Node(this);
        ChasePlayerNode  chasePlayerNode  = new ChasePlayerNode(this);
        ShotByPlayerNode shotByPlayerNode = new ShotByPlayerNode(this);
        PatrolNode       patrolNode       = new PatrolNode(this);

        sequenceNode1.add_kid(checkIfPlayerIsNearEnemyLevel1Node);
        sequenceNode1.add_kid(chasePlayerNode);
        sequenceNode2.add_kid(shotByPlayerNode);
        sequenceNode2.add_kid(chasePlayerNode);
        rootSelector.add_kid(sequenceNode1);
        rootSelector.add_kid(sequenceNode2);
        rootSelector.add_kid(patrolNode);


        behavior = new MyBehaviorTree(rootSelector);
        //behavior = new MyBehaviorTree();
    }