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); }
/// <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); }
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; } }
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); }
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); }
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(); }
protected abstract void OnEnterState(StateOwner pAvatar, StateParam nextParam);
public StateParam GetNextStateData() { StateParam param = m_fsm.GetData(fsmNextData) as StateParam; return(param); }