Beispiel #1
0
        protected override void OnEnterState(IFsm <Avatar> pAvatar, StateParam nextParam)
        {
            StateSkillParam param = nextParam as StateSkillParam;

            if (param == null)
            {
                Log.Error("Current State '{0}': the Variable's(the initParam) type isn't right! '{1}'", typeof(StateIdle), typeof(Variable));
                return;
            }
            m_nSkillID   = param.m_nSkillID;
            m_fCurTime   = 0;
            m_fTotalTime = param.m_fTotalTime;
            m_fBreakTime = param.m_fBreakTime;

            pAvatar.Owner.SetState(StateDefine.State_LockActiveSkill);
            pAvatar.Owner.SetState(StateDefine.State_LockMove);

            DRSkillData pSkillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(m_nSkillID);

            if (pSkillData == null)
            {
                Log.Error("pSkillData '{0}': pSkillData is null!", m_nSkillID);
                return;
            }
            pAvatar.Owner.PlayAnimation(pSkillData.MSV_AnimID);
        }
Beispiel #2
0
        /// <summary>
        /// 进入状态时调用。
        /// </summary>
        /// <param name="pAvatar">状态拥有者。</param>
        protected override void OnEnter(StateOwner pAvatar)
        {
            base.OnEnter(pAvatar);
            StateParam nextParam = pAvatar.Owner.GetNextStateData();

            OnEnterState(pAvatar, nextParam);
            pAvatar.Owner.SetState(m_state);
        }
Beispiel #3
0
        protected override void OnEnterState(IFsm <Avatar> pAvatar, StateParam nextParam)
        {
            StateIdleParam param = nextParam as StateIdleParam;

            if (param == null)
            {
                Log.Error("Current State '{0}': the Variable's(the initParam) type isn't right! '{1}'", typeof(StateIdle).ToString(), typeof(Variable).ToString());
                return;
            }
        }
Beispiel #4
0
        protected override void OnEnterState(IFsm <Avatar> pAvatar, StateParam nextParam)
        {
            StateDeathParam param = nextParam as StateDeathParam;

            if (param == null)
            {
                Log.Error("Current State '{0}': the Variable's(the initParam) type isn't right! '{1}'", typeof(StateIdle), typeof(Variable));
                return;
            }
            pAvatar.Owner.PlayAnimation((int)CommonAnimation.Death);
        }
Beispiel #5
0
 public bool SetFsmState(object sender, StateParam stateData)
 {
     if (m_fsm == null || m_fsm.CurrentState == null)
     {
         return(false);
     }
     m_changeFlag = false;
     m_fsm.SetData(fsmNextData, stateData);
     m_fsm.FireEvent(sender, (int)eFsmEvent.ChangeState, stateData);
     m_fsm.SetData(fsmNextData, null);
     return(m_changeFlag);
 }
Beispiel #6
0
        protected void DefaultChangeState(IFsm <Avatar> fsm, object sender, object userData)
        {
            StateParam param = userData as StateParam;

            if (param == null)
            {
                return;
            }

            if (!CanChangeState(fsm, param.m_state))
            {
                return;
            }

            ChangeState(fsm, param.m_state);
            fsm.Owner.ChangeStateSucc();
        }
Beispiel #7
0
 protected abstract void OnEnterState(StateOwner pAvatar, StateParam nextParam);
Beispiel #8
0
        public StateParam GetNextStateData()
        {
            StateParam param = m_fsm.GetData(fsmNextData) as StateParam;

            return(param);
        }