public void SetState(ISceneState state) { if (_state != null) { _state.StateEnd(); //让 上一个状态 结束 } _state = state; if (isLoadScene) { _async = SceneManager.LoadSceneAsync(_state.SceneName); } else { isLoadScene = true; _state.StateStart(); _isStart = true; } _isStart = false; //场景加载成功后调用 //_state.StateStart(); //开始下一个状态 }
public void StateUpdate() { if (mAO != null && mAO.isDone != true) { return; } if (mIsRunedStart == false && mAO != null && mAO.isDone) { mState.StateStart(); mIsRunedStart = true; } if (mState != null) { mState.StateUpdate(); } }
/// <summary> ///更新状态(场景)方法 /// </summary> public void StateUpdate() { if (ao != null && ao.isDone == false) { return; //如果处于正在加载的过程中,就不用更新状态了 } if (ao != null && ao.isDone == true && isRunStart == false) //如果异步加载完成,并且没有运行过SetState()方法就执行加载资源啥的方法 { sceneState.StateStart(); isRunStart = true; } if (sceneState != null) { sceneState.StateUpDate(); } }
public void Update() { if (mAO != null && mAO.isDone == false) { return; } if (mAO != null && mAO.isDone == true && mIsRunStart == false) { mState.StateStart(); mIsRunStart = true; } if (mState != null) { mState.StateUpDate(); } }
public void StateUpdate() { if (mAO != null && mAO.isDone == false) { return; //表示场景正在加载,所以不执行下面的代码 } if (mIsRunStart == false && mAO != null && mAO.isDone == true) { mState.StateStart(); mIsRunStart = true;//控制只调用一次 } if (mState != null) { mState.StateUpdata(); } }
public void StateUpdate() { if (m_AO != null && !m_AO.isDone) { return; } if (!isRunStart && m_AO != null && m_AO.isDone) { state.StateStart(); isRunStart = true; } if (state != null) { state.StateUpdate(); } }
} //设置场景状态,加载场景,清理上一个场景等操作 public void StateUpdate() { if (mAO != null && mAO.isDone == false) { return; //当前场景正在加载但是没有完成,直接返回 } if (mIsRunStart == false && mAO != null && mAO.isDone == true) //同样判断当前场景是否加载完,但是需要跳过初始场景 { mState.StateStart(); mIsRunStart = true; } if (mState != null) { mState.StateUpdate(); } } //更新场景,当场景加载完毕时,启动初始化方法,初始化场景
public void StateUpdate() { if (_async != null && _async.isDone == false) { return; //场景正在切换 } if (_isStart == false && _async != null && _async.isDone == true) { _state.StateStart(); _isStart = true; } if (_state != null) { _state.StateUpdate(); } }
public void SetState(ISceneState sceneState, bool isLoadScene = true) { if (mISceneState != null) { mISceneState.StateEnd(); } mISceneState = sceneState; if (isLoadScene) { mStateAO = SceneManager.LoadSceneAsync(mISceneState.SceneName); mIsRunStart = false; } else { mISceneState.StateStart(); mIsRunStart = true; } }
public void SetState(ISceneState state, bool isLoadScene = true) { if (mState != null) { mState.StateEnd();//上一个状态的清理工作 } mState = state; if (isLoadScene) { mAO = SceneManager.LoadSceneAsync(state.SceneName); mIsRunedStart = false; } else { mState.StateStart(); mIsRunedStart = true; } }
public void StateUpdate() { //当场景还在加载时,不执行StateUpdate() if (mAO != null && mAO.isDone == false) { return; } if (mAO != null && mAO.isDone == true && !mIsRunStart) { mState.StateStart(); mIsRunStart = true; } if (mState != null) { mState.StateUpdate(); } }
public void StateUpdate() { if (mStateAO != null && mStateAO.isDone == false) { return; } if (mIsRunStart == false && mStateAO != null && mStateAO.isDone == true) { mISceneState.StateStart(); mIsRunStart = true; } if (mISceneState != null) { mISceneState.StateUpdate(); } }
private bool mIsRunStart = false; //是否启动当前状态,主要是判断场景是否加载完毕 public void SetState(ISceneState state, bool isLoadScene) { if (mState != null) { mState.StateEnd();//让上一个场景状态做一下清理工作 } mState = state; if (isLoadScene) { mAO = SceneManager.LoadSceneAsync(mState.getName()); mIsRunStart = false; } else { mState.StateStart();//启动当前状态的初始化操作 mIsRunStart = true; } } //设置场景状态,加载场景,清理上一个场景等操作
public void StateUpdate() { if (m_Ao != null && m_Ao.isDone == false) { Debug.Log("正在加载场景"); return; } if (m_Ao != null && m_Ao.isDone == true && m_IsRunStart == false) { m_State.StateStart(); m_IsRunStart = true; } if (m_State != null) { m_State.StateUpdate(); } }
public void SetState(ISceneState state, bool isLoadScene = true) { if (mState != null) { //让上一个场景状态做一下清理工作 mState.StateEnd(); } mState = state; if (isLoadScene) { mAO = SceneManager.LoadSceneAsync(mState.SceneName); mIsRunStart = false; } else { mState.StateStart(); mIsRunStart = true; } }
public void SetState(ISceneState state, bool isLoadScene = true) { if (mState != null) { mState.StateEnd(); // 对上一个场景做清理工作 } mState = state; // 如果需要加载该场景(默认true), 进行加载事件。 否则直接执行 StateStart() 方法。 if (isLoadScene) { mAO = SceneManager.LoadSceneAsync(mState.SceneName); } else { mState.StateStart(); } }
public void SetState(ISceneState state, bool isLoadScene = true) { if (mState != null) { mState.StateEnd(); } mState = state; //需要加载的情况 if (isLoadScene) { //异步加载 mAO = SceneManager.LoadSceneAsync(mState.SceneName); mIsRunStart = false; } else { mState.StateStart(); mIsRunStart = true; } }
private bool m_IsRunStart = false; //判断是否执行过一次StateStart方法 /// <summary> /// 设置状态 /// </summary> /// <param name="state"></param> /// <param name="isLoadScene">是否需要加载场景</param> public void SetState(ISceneState state, bool isLoadScene = true) { if (m_State != null) { m_State.StateEnd(); //让上一个场景进行清理工作 } m_State = state; if (isLoadScene) { //异步加载场景 m_Ao = SceneManager.LoadSceneAsync(m_State.SceneName); m_IsRunStart = false; } else { m_State.StateStart(); m_IsRunStart = true; } }
//------------------------------------------------------ //状态的更新 public void StateUpdate() { //如果场景未加载完毕则返回 if (_async != null && !_async.isDone) { return; } //首次运行 if (_mstate != null && _mRunBegin == false) { _mRunBegin = true; _mstate.StateStart(); } //不断更新 if (_mstate != null) { _mstate.StateUpdate(); } }
public void StartUpdate() { // 如果场景还没加载完 说明目前场景属于过度阶段 则不需要进行更新 直接return if (mAO != null && mAO.isDone == false) { return; } // 如果场景刚刚加载完 将mAO置空 执行 StateStart() 事件 if (mAO != null && mAO.isDone == true) { mAO = null; mState.StateStart(); } // 如果目前 mState 不为空 执行 StateUpdate() if (mState != null) { mState.StateUpdate(); } }
/// <summary> /// 状态更新 /// </summary> public void StateUpdate() { // 正在切换场景 if (mAO != null && !mAO.isDone) { return; } // 场景是否加载完成 if (mAO != null && mAO.isDone && !mIsRunStartState) { // 设置开始状态 mSceneState.StateStart(); mIsRunStartState = true; } // 设置状态更新 if (mSceneState != null) { mSceneState.StateUpdate(); } }
public void UpdateState() { //场景加载ing,直接返回 if (m_AO != null && !m_AO.isDone) { return; } //场景加载完毕,直接切换场景 if (m_AO != null && m_AO.isDone && !m_IsRunState) { m_SceneState.StateStart(); m_IsRunState = true; } //场景运行中 if (m_SceneState != null) { m_SceneState.StateUpdate(); } }
private bool mIsRunStartState = false; // 是否运行过 StartState 方法 /// <summary> /// 设置状态 /// </summary> /// <param name="state">状态</param> /// <param name="isLoadScene">是否需要加载场景</param> public void SetState(ISceneState state, bool isLoadScene = true) { // 如果当前状态不为空,就让当前状态做一下清理工作 if (mSceneState != null) { mSceneState.StateEnd(); } // 设置当前状态 mSceneState = state; // 加载指定状态 if (isLoadScene) // 是否需要加载场景 { // 异步加载场景 mAO = SceneManager.LoadSceneAsync(mSceneState.SceneName); mIsRunStartState = false; } else { mSceneState.StateStart(); // 设置开始状态 isLoadScene = true; } }
public void SetState(ISceneState state, bool isLoadScene = true) { //通知前一个State结束 if (state != null) { state.StateEnd(); } Debug.Log("SetState:" + state.ToString()); this.state = state; if (isLoadScene) { m_AO = SceneManager.LoadSceneAsync(state.SceneName); isRunStart = false; } else { state.StateStart(); isRunStart = true; } }