コード例 #1
0
ファイル: Frog.cs プロジェクト: chickening/TeemoRPG
    protected override void Start()
    {
        base.Start();
        skillReaderList.Add(new SkillReader(SkillManager.FindSkill("FrogGeneralAttack")));
        BT BTAttack = BT.Sequence
                      (
            BT.Call(GeneralAttack)
                      );
        BT BTPatrol = BT.Sequence
                      (
            BT.Success(BT.Call(RandomWayPoint)),
            BT.Success(BT.Call(FindAroundEnemy)),
            BT.Condition(() => { return(!isFoundEnemy); }, BT.Call(Move))
                      );

        AI = BT.Root
             (
            BT.Sequence
            (
                BT.Success(BT.Call(FindAroundEnemy)),
                BT.Selector
                (
                    BT.Condition(() => { return(isFoundEnemy); }, BTAttack),
                    BT.Probability(0.3f * Time.fixedDeltaTime, BTPatrol)
                )
            )
             );
        moveMaxDelay = new Delay();
    }
コード例 #2
0
    private void OnEnable()
    {
        agentBehaviour = GetComponent <AgentBehaviour>();
        aiBehaviour    = GetComponent <AIBehaviour>();
        layerMask      = LayerMask.NameToLayer("Elemnet");
        m_Ai.AddBehaviours(
            BT.Selector().AddBehaviours(
                BT.Sequence().AddBehaviours(
                    BT.Condition(() => { return(aiBehaviour.getCircleElementsNum() > 2); }),
                    //如果没有发现敌人和方块则自由移动
                    BT.Sequence().AddBehaviours(
                        //如果没有发现
                        BT.If(() => { return(!isFindElement && !isFindPlayer); }).AddBehaviours(
                            //进行随机移动
                            BT.Call(agentBehaviour.RandomWalk)
                            //进行随搜
                            //BT.Call(CheckForAround)
                            ),
                        //如果有发现
                        BT.If(() => { return(isFindElement); }).AddBehaviours(

                            BT.Call(agentBehaviour.Pursue)

                            )

                        )
                    )
                )

            );
    }
コード例 #3
0
        private void OnEnable()
        {
            _behave = GetComponent <BossBehave>();

            _AI.OpenBranch(
                BT.Selector().OpenBranch(
                    BT.While(_behave.Opening).OpenBranch(
                        BT.Call(_behave.MoveToTarget),
                        BT.Wait(0.5f),
                        BT.Call(_behave.DashAttack),
                        BT.Wait(2f),
                        BT.Call(_behave.TurnToTarget),
                        BT.Call(_behave.AfterOpening)
                        ),

                    BT.If(_behave.Moving).OpenBranch(
                        BT.Wait(Time.deltaTime),
                        BT.Call(_behave.Initialization)
                        ),

                    BT.Sequence().OpenBranch(
                        BT.Condition(_behave.TooFar),
                        BT.Call(_behave.Charge)
                        ),

                    BT.Sequence().OpenBranch(
                        BT.Condition(_behave.NeedDodge),
                        BT.Call(_behave.Dodge),
                        BT.Wait(0.5f),
                        BT.RandomSequence().OpenBranch(
                            BT.Call(_behave.Slash),
                            BT.Call(_behave.DashAttack)
                            ),
                        BT.Call(_behave.TurnToTarget)
                        ),

                    BT.Sequence().OpenBranch(
                        BT.Condition(_behave.InAttackRange),
                        BT.RandomSequence().OpenBranch(
                            BT.Call(_behave.Slash),
                            BT.Call(_behave.JumpAttack),
                            BT.Call(_behave.DashAttack)
                            ),
                        BT.Call(_behave.TurnToTarget)
                        ),

                    BT.Sequence().OpenBranch(
                        BT.Call(_behave.Charge),
                        BT.Wait(0.5f)
                        )
                    )
                );
        }
コード例 #4
0
    public void Awake()
    {
        Monster = GetComponent <MonsterSetting>();

        AI = BT.Root();

        AI.OpenBranch(
            BT.Selector().OpenBranch(

                BT.Sequence().OpenBranch(BT.Condition(Monster.CanAttack), BT.Call(Monster.Attack)),

                BT.Call(Monster.Idle))

            );
    }
コード例 #5
0
 private void OnEnable()
 {
     meleeRoot.OpenBranch(
         BT.Selector().OpenBranch(
             BT.Sequence().OpenBranch(
                 BT.Condition(meleeBehave.AttackAction),
                 BT.Call(meleeBehave.Attack),
                 BT.Wait(_attackIntervalMelee)
                 ),
             BT.Sequence().OpenBranch(
                 BT.Condition(meleeBehave.AlertAction),
                 BT.Call(meleeBehave.Alert),
                 BT.Call(meleeBehave.Charge),
                 BT.Call(meleeBehave.MoveToPlayer)
                 ),
             BT.Call(meleeBehave.Patrol)
             )
         );
 }
コード例 #6
0
 private void OnEnable()
 {
     enemyRoot.OpenBranch(
         BT.Selector().OpenBranch(
             BT.Sequence().OpenBranch(
                 BT.Condition(enemyBehave.needDodge),
                 BT.Call(enemyBehave.Dodge)
                 ),
             BT.Sequence().OpenBranch(
                 BT.Condition(enemyBehave.AttackAction),
                 BT.Call(enemyBehave.Attack),
                 BT.Wait(_attackInterval)
                 ),
             BT.Sequence().OpenBranch(
                 BT.Condition(enemyBehave.AlertAction),
                 BT.Call(enemyBehave.Alert),
                 BT.Call(enemyBehave.MoveToPlayer)
                 ),
             BT.Call(enemyBehave.Patrol)
             )
         );
 }