コード例 #1
0
ファイル: SentryBT.cs プロジェクト: TyRawr/pixel_platformer
        private void OnEnable()
        {
            m_EnemyBehaviour = GetComponent <SentryEnemyBehavior>();
            m_Animator       = GetComponent <Animator>();

            m_Ai.OpenBranch(
                BT.Trigger(m_Animator, "Shooting"),
                BT.Call(m_EnemyBehaviour.RememberTargetPos),
                BT.WaitForAnimatorState(m_Animator, "Attack")
                );
        }
コード例 #2
0
        private void OnEnable()
        {
            m_EnemyBehaviour = GetComponent <EnemyBehaviour>();
            m_Animator       = GetComponent <Animator>();

            m_Ai.OpenBranch(
                BT.If(() => { return(m_EnemyBehaviour.Target != null); }).OpenBranch(
                    BT.Call(m_EnemyBehaviour.CheckTargetStillVisible),
                    BT.Call(m_EnemyBehaviour.OrientToTarget),
                    BT.Trigger(m_Animator, "Shooting"),
                    BT.Call(m_EnemyBehaviour.RememberTargetPos),
                    BT.WaitForAnimatorState(m_Animator, "Attack")
                    ),
                BT.If(() => { return(m_EnemyBehaviour.Target == null); }).OpenBranch(
                    BT.Call(m_EnemyBehaviour.ScanForPlayer)
                    )
                );
        }