Esempio n. 1
0
        protected override bool CustomPrecondition(TBTWorkingData wData)
        {
            bool result = false;

            if (EntityFactory.MainHeroView == null || !EntityFactory.MainHeroView.IsValid)
            {
                return(result);
            }

            GuideWorkingData gData = wData as GuideWorkingData;

            int        nDeadEntityID = gData.GuideDynamicBB.GetValue <int>(EGuideBBKey.DeadEntityID, -1);
            EntityView ev            = EntityFactory.getEntityViewByID(nDeadEntityID);

            if (nDeadEntityID != -1 && ev != null)
            {
                int propertyID = ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);

                result = propertyID == m_nPropertyID;
            }

            return(result);
        }
Esempio n. 2
0
        protected override bool CustomPrecondition(TBTWorkingData wData)
        {
            bool result = m_bDoOnce;

            if (!m_bDoOnce)
            {
                GuideWorkingData gData          = wData as GuideWorkingData;
                Vector3          MonsterDeadPos = gData.GuideDynamicBB.GetValue <Vector3>(EGuideBBKey.DeadEntityID, Vector3.zero);
                if (MonsterDeadPos.magnitude != 0 && EntityFactory.MainHero != null)
                {
                    result = (EntityFactory.MainHero.transform.position - MonsterDeadPos).sqrMagnitude <= m_nNearbySize;
                    //清空下
                    if (result)
                    {
                        gData.GuideDynamicBB.SetValue(EGuideBBKey.DeadEntityID, Vector3.zero);
                        m_bDoOnce = true;
                    }
                }
                TLogger.PROFILE("判断玩家附近是否有敌方实体死亡(实体死亡会销毁比较难检测到):" + result);
            }

            return(result);
        }
    public override bool IsTrue(TBTWorkingData wData)
    {
        BattleDecisionWorkingData decisionData = wData as BattleDecisionWorkingData;
        BattleUnit battleEntity = decisionData.owner;

        if (!battleEntity.IsCanDecision())
        {
            return(false);
        }

        // 新的决策
        AIBehaviorRequest request = decisionData.request;

        if (request == null)
        {
            return(true);
        }
        else
        {
            //上一个请求已经执行完成,就更新新请求
            return(request.IsRequestCompleted());
        }
    }
Esempio n. 4
0
        protected override int onExecute(TBTWorkingData wData)
        {
            GuideWorkingData gData = wData as GuideWorkingData;

            UGuideWidget widget0 = GuideManager.Instance.GetGuideWidget(gData.GuideCurrentNode, 0);

            if (widget0 != null && widget0.gameObject.activeInHierarchy && widget0.gameObject.activeSelf && !widget0.IsWidgetShow())
            {
                widget0.Show();
            }
            else if (widget0 == null)
            {
                UISystem.Instance.SendTargetWndMessage(WndID.WND_ID_PLAYERBUTTONFRAME, WndMsgID.WND_MSG_PLAYERBUTTONFRAME_WARHALLBUTTON_ADDGUIDEWIDGET,
                                                       new UGuideWidgetMsgData((int)gData.GuideCurrentNode, 0, m_nEffectID, _bClickEvent: false));
            }

            UGuideWidget widget1 = GuideManager.Instance.GetGuideWidget(gData.GuideCurrentNode, 1);

            if (widget1 != null && widget1.gameObject.activeInHierarchy && widget1.gameObject.activeSelf && !widget1.IsWidgetShow())
            {
                widget1.Show();
            }
            else if (widget1 == null)
            {
                UISystem.Instance.SendTargetWndMessage(WndID.WND_ID_WAR_MAIN_FRAME, WndMsgID.WND_MSG_WAR_MAIN_GAMEMODEBTN_ADDGUIDEWIDGET,
                                                       new UGuideWidgetMsgData((int)gData.GuideCurrentNode, 1, m_nEffectID, _oUserData: m_nGameModeID, _bClickEvent: false));
            }

            int result = TBTRunningStatus.EXECUTING;

            if (LogicDataCenter.lifeHeroDataManager.HistoryRecord.Count >= m_nMatchLimit)
            {
                result = base.onExecute(wData);
            }

            return(result);
        }
Esempio n. 5
0
 public virtual void Destroy(TBTWorkingData _data)
 {
     Transition(_data);
     GuideManager.Instance.RestoreGuideNodeConfigData();
 }
Esempio n. 6
0
        protected override int onExecute(TBTWorkingData wData)
        {
            wData.As <GuideWorkingData>().GuideDynamicBB.SetValue(EGuideBBKey.LogicStepID, m_eGuideNodeID);

            return(base.onExecute(wData));
        }
Esempio n. 7
0
 protected override void onEnter(TBTWorkingData wData)
 {
     base.onEnter(wData);
     UISystem.Instance.SendTargetWndMessage(m_eGuideActonWnd, m_eGuideActionMsgID, m_widgetMsgData);
 }
Esempio n. 8
0
 protected override int onExecute(TBTWorkingData wData)
 {
     return(TBTRunningStatus.EXECUTING);
 }
Esempio n. 9
0
 protected override void onEnter(TBTWorkingData wData)
 {
     GuideManager.Instance.SetNoviceGuideType(nStepID);
 }
Esempio n. 10
0
 protected override void onEnter(TBTWorkingData wData)
 {
     base.onEnter(wData);
     m_nStateParam.WorkingData = wData as GuideWorkingData;
     m_nStateParam.ActionLeaf  = this;
 }
Esempio n. 11
0
 protected override int onExecute(TBTWorkingData wData)
 {
     return(TBTRunningStatus.FINISHED);
 }
Esempio n. 12
0
            protected override void onEnter(TBTWorkingData wData)
            {
                AIEntityWorkingData thisData = wData.As <AIEntityWorkingData>();

                thisData.entityAnimation.Play("idle");
            }
Esempio n. 13
0
 public abstract bool isTrue(TBTWorkingData wData);
Esempio n. 14
0
 public abstract bool isTrue(TBTWorkingData wData);
Esempio n. 15
0
 public override bool IsTrue(/*in*/ TBTWorkingData wData)
 {
     return(GetChild <TBTPrecondition>(0).IsTrue(wData) ^
            GetChild <TBTPrecondition>(1).IsTrue(wData));
 }
Esempio n. 16
0
 protected virtual void onExit(TBTWorkingData wData, int runningStatus)
 {
 }
Esempio n. 17
0
            protected override void onEnter(TBTWorkingData wData)
            {
                AIEntityWorkingData thisData = wData.As <AIEntityWorkingData>();

                thisData.entityAnimator.CrossFade("attack", 0.2f);
            }
Esempio n. 18
0
 protected override void onExit(TBTWorkingData wData, int runningStatus)
 {
     base.onExit(wData, runningStatus);
 }
Esempio n. 19
0
 protected override bool onEvaluate(TBTWorkingData wData)
 {
     return(base.onEvaluate(wData));
 }
Esempio n. 20
0
        protected override void onEnter(TBTWorkingData wData)
        {
            m_MainHeroTrans = EntityFactory.MainHeroView.StateMachine.transform;

            InitSplineMesh();
        }
Esempio n. 21
0
 protected override int onExecute(TBTWorkingData wData)
 {
     return(TurnToStatus);
 }
Esempio n. 22
0
 protected override void onEnter(TBTWorkingData wData)
 {
     SoundManager.CreateUISound(m_nSoundID);
 }
Esempio n. 23
0
 protected override void onExit(TBTWorkingData wData, int runningStatus)
 {
     BattleLog.Log("【NOD_CastAbility】onExit");
 }
Esempio n. 24
0
 protected override void onEnter(TBTWorkingData wData)
 {
     base.onEnter(wData);
     InputManager.Available = m_bEnable;
 }
Esempio n. 25
0
    protected override int onExecute(TBTWorkingData wData)
    {
        BotWorkingData thisData = wData.As<BotWorkingData>();
        //Debugger.LogErrorFormat("dis={0}, delta={1}, Name={2}, _TargetPos={3}, NodeWander.HashCode={4}",
        //Vector3.Distance(_TargetPos, thisData._Character.Head.transform.position), ConstValue._MinMoveDelta, thisData._Character.Name, _TargetPos, GetHashCode());
        //Debugger.LogGreen("curtime=" + _CurSteerTime);
        Vector3 targetPos = _TargetPos;
        Vector3 currentPos = thisData._Character.Head.transform.position;
        float distToTarget = Vector3.Distance(targetPos, currentPos);
        if (distToTarget < thisData._Character.MoveMotion)
        {
            if (_InWander)
            {
                //Debugger.LogFormat("reach dest class={0}, method={1}", LogColor.Blue, false, LogUtil.GetCurClassName(), LogUtil.GetCurMethodName());
                _CurSteerTime = _SteerGapTime;
                _InWander = false;
                _LastStepPoses.Clear();
            }
        }

        // check enemy operation has a cool down time. 
        if (_CurCheckTime > 0)
        {
            _CurCheckTime -= thisData._DeltaTime;
        }
        else
        {
            UnityEngine.Profiling.Profiler.BeginSample("NodeWander.onExecute CheckEnemy");
            _CurCheckTime = _CheckGapTime;
            var player = (thisData._Character as Enemy);
            if (player != null)
            {
                player.CheckEnemy();
            }
            UnityEngine.Profiling.Profiler.EndSample();
            //Debugger.LogFormat("check enemy class={0}, method={1}", LogColor.Brown, false, LogUtil.GetCurClassName(), LogUtil.GetCurMethodName());
        }

        // wait for next wander command
        if (_CurSteerTime > 0)
        {
            _CurSteerTime -= thisData._DeltaTime;
        }
        else
        {
            if (!_InWander)
            {
                //Debugger.LogFormat("generate pos class={0}, method={1}", LogColor.Cyan, false, LogUtil.GetCurClassName(), LogUtil.GetCurMethodName());
                GenerateTargetPos(thisData._Character.Head.transform.position, wData);
                _InWander = true;
            }
        }

        if (_InWander)
        {
            //Debugger.LogFormat("steer to class={0}, method={1}", LogColor.Green, false, LogUtil.GetCurClassName(), LogUtil.GetCurMethodName());
            UnityEngine.Profiling.Profiler.BeginSample("NodeWander.onExecute InWander");
            var motion = (_TargetPos - thisData._Character.Head.transform.position).normalized
                * thisData._Character.MoveSpeed * Singleton._DelayUtil.Timer.DeltaTime;
            bool rs = thisData._Character.Move(motion);
            if (!rs)
            {
                if (_InWander)
                {
                    _CurSteerTime = _SteerGapTime;
                    _InWander = false;
                    _LastStepPoses.Clear();
                }
            }

            if (_LastStepPoses.Count == _MaxRecordStepCount)
            {
                int nearCount = 0;
                foreach (var item in _LastStepPoses)
                {
                    if (Vector3.Distance(item, thisData._Character.Head.transform.position) < thisData._Character.MoveMotion / 2f)
                    {
                        nearCount += 1;
                    }
                }
                if (nearCount >= 2)
                {
                    //Debug.LogErrorFormat("nearCount name={0}, peek={1}, dist={2}, delta={3}",
                    //    _Character.Name, _LastStepPoses.Peek(),
                    //    Vector3.Distance(_LastStepPoses.Peek(), _Character.Head.transform.position),
                    //    _Character.MoveMotion);
                    if (_InWander)
                    {
                        _CurSteerTime = _SteerGapTime;
                        _InWander = false;
                        _LastStepPoses.Clear();
                    }
                }
            }
            Assert.IsTrue(_LastStepPoses.Count <= _MaxRecordStepCount);
            if (_LastStepPoses.Count == _MaxRecordStepCount)
            {
                _LastStepPoses.Dequeue();
            }
            _LastStepPoses.Enqueue(thisData._Character.Head.transform.position);

            UnityEngine.Profiling.Profiler.EndSample();
        }
        return TBTRunningStatus.EXECUTING;
    }
Esempio n. 26
0
 protected override int onExecute(TBTWorkingData wData)
 {
     EntityEventHelper.Instance.SendCommand(EntityFactory.MainHeroID, m_eCommandID, m_nParam, m_strParam);
     return(base.onExecute(wData));
 }
Esempio n. 27
0
 protected T getUserContexData <T>(TBTWorkingData wData) where T : class, new()
 {
     return(getContext <TBTActionLeafContext>(wData).getUserData <T>());
 }
Esempio n. 28
0
 protected override void onTransition(TBTWorkingData wData)
 {
     base.onTransition(wData);
 }
Esempio n. 29
0
 //--------------------------------------------------------
 // inherented by children-
 protected virtual void onEnter(/*in*/ TBTWorkingData wData)
 {
 }
Esempio n. 30
0
 protected override void onTransition(TBTWorkingData wData)
 {
     base.onTransition(wData);
     m_bRunning = false;
 }
Esempio n. 31
0
 protected virtual int onExecute(TBTWorkingData wData)
 {
     return(TBTRunningStatus.FINISHED);
 }