private void notifyClose(CameraPathState state, CameraArea area, int now) { //可以不通过回调 if (area == null) { return; } setCameraState(state, area.from, now, false); //switch (state) //{ // case CameraPathState.State_ExitCurse: // setCameraState(CameraPathState.State_ExitCurse, area.from, now, false); // //funcs.NotifyCurseCamera(area.from, (int)Math.Floor(pos), false); // break; // case CameraPathState.State_ChongCi: // setCameraState(CameraPathState.State_ChongCi, area.from, now, false); // //funcs.NotifyChongCiCamera(area.from, (int)Math.Floor(pos), false); // break; // case CameraPathState.State_GotWinner: // //funcs.NotifyWinnerCamera(area.from, (int)Math.Floor(pos), false); // setCameraState(CameraPathState.State_GotWinner, area.from, now, false); // break; //} }
private void applytempState() { if (tempState != currentstate) { int now = (int)Math.Floor(pos); if (currentTriggerArea != null) { notifyClose(currentstate, currentTriggerArea, now); } currentstate = tempState; currentTriggerArea = tempArea; if (currentTriggerArea != null) { notifyEnable(currentstate, currentTriggerArea, now); } laststate = currentstate; lastTriggerArea = currentTriggerArea; } tempState = currentstate; if (currentTriggerArea == null) { tempState = CameraPathState.None; } }
public Transform getCameraPara(CameraPathState p, int start, int now) { //其中根据start应该是一定要有的 if (cameraParamSet.ContainsKey(p)) { Dictionary <int, Transform> set = cameraParamSet[p]; if (set.ContainsKey(now)) { return(set[now]); } if (!set.ContainsKey(start)) { Log.Error("error happens. 根据start一定要找到配置"); } return(set[start]); } return(null); }
public void setCameraState(CameraPathState state, int start, int now, bool active) { if (cameraParamSet == null) { } if (active) { //Transform t = funcs.GetCameraPathParam(state, start, now); Transform t = getCameraPara(state, start, now); if (state == CameraPathState.State_ExitCurse) { SoundTools.PlaySoundEffect("chuwan2"); //出弯 SetAndOpenExitCurseCamera(t); } else if (state == CameraPathState.State_ChongCi) { SoundTools.PlaySoundEffect("chongci2"); //冲刺 SetAndOpenChongCiCamera(t); } else if (state == CameraPathState.State_GotWinner) { SoundTools.PlaySoundEffect("qingzhu2"); //庆祝 SetAndOpenWinnerCamera(t); } } else { if (state == CameraPathState.State_ExitCurse) { CloseExitCurseCamera(); } else if (state == CameraPathState.State_ChongCi) { CloseChongCiCamrea(); } else if (state == CameraPathState.State_GotWinner) { CloseWinnerCamera(); } } }
private void setTempTriggerArea(CameraPathState state, CameraArea area) { if (area == null) { if (currentstate == state) { int uselessInt = -1; notifyClose(state, currentTriggerArea, uselessInt); currentTriggerArea = null; } return; } //define rules to make transisition happen if (state > tempState || state == CameraPathState.None) { if (tempState != state) { tempState = state; tempArea = area; } } }