コード例 #1
0
    private void Start()
    {
        SmokeEnemy =
            new BTSequence(showNode,
                           new BTCheckAttack(underAttack, isAtPlayer, agent),
                           new BTFlyToCover(agent, cover),
                           new BTWait(3f),
                           new BTThrowSmoke(prefabBom, child, underAttack, hasAttacked)
                           );

        RotateAroundPlayer =
            new BTSequence(showNode,
                           new BTTCheckAtPlayer(isAtPlayer),
                           new BTFlyArroundPlayer(isAtPlayer, agent, child, player)
                           );

        GoToPlayer =
            new BTSequence(showNode,
                           new BTCheckAttackDone(hasAttacked, agent),
                           new BTMoveAlly(hasAttacked, isAtPlayer, child, agent, player)
                           );

        rootNode = new BTSelector(new List <BTBaseNode> {
            SmokeEnemy, GoToPlayer, RotateAroundPlayer
        });
        rootNode.Run();
    }
コード例 #2
0
    private void Start()
    {
        CheckSmoke =
            new BTSequence(showNode,
                           new BTCheckSmoke(isInSmoke, agent)
                           );

        AttackTree =
            new BTSequence(showNode,
                           new CheckPlayerRange(ClosestPlayer, hasWeapon, needsWeapon),
                           new BTMove(agent, ClosestPlayer, showNode, weaponHolder, hasWeapon, cantAttack, lighting, WeaponCol)
                           );

        CheckWeapon =
            new BTSequence(showNode,
                           new FindWeapon(needsWeapon),
                           new BTGoForWeapon(agent, weapon, hasWeapon, needsWeapon, weaponHolder, weapon, lighting, CheckForWeaponCol)
                           );

        PatrollTree =
            new BTSequence(showNode,
                           new BTPatrol(WayPoints, agent, lighting, PatrolCol)
                           );


        rootNode = new BTSelector(new List <BTBaseNode> {
            CheckSmoke, CheckWeapon, AttackTree, PatrollTree
        });
        rootNode.Run();
    }
コード例 #3
0
 private void FixedUpdate()
 {
     if (enemyTXT.text == "BTMove")
     {
         underAttack.active = true;
     }
     rootNode?.Run();
 }
コード例 #4
0
 private void FixedUpdate()
 {
     checkSmoke();
     FindVisibleTargets();
     rootNode?.Run();
 }