void OnTriggerEnter(Collider other) { if (!sequenceToPlay) { Debug.LogWarning("You have triggered a sequence in your scene, however, you didn't assign it a Sequence To Play", gameObject); return; } if (sequenceToPlay.IsPlaying) { return; } if (other.CompareTag("MainCamera") && isMainCameraTrigger) { sequenceToPlay.Play(); return; } if (other.CompareTag("Player") && isPlayerTrigger) { sequenceToPlay.Play(); return; } if (other.gameObject == triggerObject) { sequenceToPlay.Play(); return; } }
public override void OnEnter() { if (Fsm == null) { return; } GameObject go = Fsm.GetOwnerDefaultTarget(sequenceToPlay); if (!go) { return; } USSequencer sequence = go.GetComponent <USSequencer>(); if (!go) { return; } sequence.PlaybackFinished += OnSequenceFinished; sequence.RunningTime = timeToStart.Value; sequence.Play(); Fsm.Event(startedPlayback); }
IEnumerator CutSceneForStart() { GameObject obj = GameObject.Find("Sequence"); USSequencer seq = obj.GetComponent <USSequencer>(); if (null == seq) { yield break; } //Transform timelineTrans = seq.transform.FindChild("Timelines for StartCameraRoot"); //USTimelineContainer timeline = timelineTrans.GetComponent<USTimelineContainer>(); //timeline.AffectedObject = startCamObj.transform; //USTimelineEvent evt = timeline.GetComponentInChildren<USTimelineEvent>(); //USMatchObjectEvent matchEvt = evt.GetComponentInChildren<USMatchObjectEvent>(); // matchEvt.objectToMatch = CameraManager.instance.mainCamera.gameObject; seq.PlaybackStarted = (sequence) => { }; seq.PlaybackFinished = (sequence) => { }; seq.Play(); }
private void OnMessageReceived() { if (_uSequencer) { _uSequencer.Play(); } }
private void OnAniStart(USSequencer us) { m_CurAni = us; m_CurAni.Play(); PlayerData.Instance.RideData.SendChangeRideStateRequest(0); //进入剧情动画需要下马 SetJoystickEnable(false); //播放过场动画开始时禁用摇杆 OpenUI(); CoreEntry.gAutoAIMgr.IsSuspend = true; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_StoryStart, EventParameter.Get()); }
public void playSeq(System.Action callback1, System.Action callback2) { storeAliveCamera(); seqObject1.gameObject.SetActive(true); seqObject2.gameObject.SetActive(true); //UIMgr.setTownPanelVisible (false); //UIMgr.setMapPanelVisible (false); //UIMgr.setChatPopupVisible(false); seqObject1.PlaybackFinished = (sequence) => { //callback1(); }; seqObject2.PlaybackFinished = (sequence) => { callback2(); /* * SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.NONE); * StartCoroutine(FakeIncreaseLoadingBar()); * * closeDialogPanel(); * callback1(); * callback2(); // == OnLevelWasLoadedPart2 * restoreUnactivedCamera(); * destroySeqObjects(); * Destroy(this.gameObject); * * UIMgr.setTownPanelVisible (true); * UIMgr.setMapPanelVisible (true); * UIMgr.setChatPopupVisible(true); */ }; seqObject1.Play(); // UIMgr.instance.UICamera.enabled = false; // // seqObject1.PlaybackFinished = (sequence) => // { // destroySeqObjects(); // // revive cameras // // // destroy // Destroy(this.gameObject); // // UIMgr.instance.UICamera.enabled = true; //GameObject.Find ("UICamera").GetComponent<Camera> ().enabled = true; // }; // seqObject1.Play (); }
public override void FireEvent() { if (!sequence) { Debug.LogWarning("No sequence for USPlaySequenceEvent : " + name, this); return; } if (!Application.isPlaying) { Debug.LogWarning("Sequence playback controls are not supported in the editor, but will work in game, just fine."); return; } if (!restartSequencer) { sequence.Play(); } else { sequence.RunningTime = 0.0f; sequence.Play(); } }
void Update() { if (hasPlayed) { return; } currentTime += Time.deltaTime; if (currentTime >= delay && sequence) { sequence.Play(); hasPlayed = true; } }
public IEnumerator Play() { if (_sequence != null) { var sequenceFinished = false; _sequence.Play(); USSequencer.PlaybackDelegate onComplete = null; onComplete = delegate { sequenceFinished = true; _sequence.PlaybackFinished -= onComplete; }; _sequence.PlaybackFinished += onComplete; while (!sequenceFinished) { yield return(new WaitForEndOfFrame()); } } }
static IEnumerator SetCutScene() { yield return(new WaitForSeconds(0.1f)); //< 카메라 정보 대입 startRootObj = new GameObject("StartCameraRoot"); //startRootObj.transform.position = CameraManager.instance.RtsCamera.transform.position; //startRootObj.transform.rotation = CameraManager.instance.RtsCamera.transform.rotation; Unit targetUnit = CutSceneEventDic[0].GetComponent <Unit>(); startRootObj.transform.position = new Vector3(targetUnit.transform.position.x, targetUnit.transform.position.y + targetUnit.UnitCollider.size.y * 2.0f, targetUnit.transform.position.z) + targetUnit.transform.forward * 35.0f; startRootObj.transform.rotation = Quaternion.LookRotation((targetUnit.transform.position + Vector3.up * (targetUnit.UnitCollider.size.y * 0.8f)) - startRootObj.transform.position); startCamObj = new GameObject("StartCamera", typeof(Camera)); startCamObj.camera.backgroundColor = CameraManager.instance.mainCamera.backgroundColor; startCamObj.camera.farClipPlane = CameraManager.instance.mainCamera.farClipPlane; startCamObj.transform.localPosition = startRootObj.transform.position; startCamObj.transform.localRotation = startRootObj.transform.rotation; startCamObj.camera.fieldOfView = CameraManager.instance.mainCamera.fieldOfView; startCamObj.AddComponent <Thinksquirrel.Utilities.CameraShake>(); //Debug.Break (); //int idx = 0; bool SetEndPos = false; CutSceneSendMessage[] list = seq.GetComponentsInChildren <CutSceneSendMessage>(true); for (int i = 0; i < list.Length; i++) { if (list[i]._CutSceneEventData != null && !list[i].EventSystem) { } else { for (int j = 0; j < list[i]._CutSceneEventData.Length; j++) { for (int p = 0; p < list[i]._CutSceneEventData[j].EventList.Length; p++) { //< 스타트 위치를 보정해준다 if (list[i]._CutSceneEventData[j].EventList[p].ActionType == eCutSceneEvent.SetStartPos) { yield return(G_GameInfo.GameInfo.StartCoroutine(ResetPosUpdate(list[i]._CutSceneEventData[j].EventList[p].ActionPos, false))); } else if (list[i]._CutSceneEventData[j].EventList[p].ActionType == eCutSceneEvent.SetDefaultPos) { //< 카메라 위치를 조정함 Vector3 center = Vector3.zero; Vector3 TargetPos = Vector3.zero; foreach (KeyValuePair <int, GameObject> obj in CutSceneEventDic) { if (obj.Value != null) { center += obj.Value.transform.position; } } center /= CutSceneEventDic.Count; TargetPos = center; //center += (CutSceneEventDic[0].transform.forward * 7.7f); //center += (CutSceneEventDic[0].transform.forward * 9f); center += (CutSceneEventDic[0].transform.forward * targetUnit.UnitCollider.size.y * 2.5f); /*USTimelineProperty Infolist = seq.GetComponentInChildren<USTimelineProperty>(); * * Infolist.Properties [0].curves [0].Keys[3].Time =seq.Duration+10; * Infolist.Properties [0].curves [1].Keys [3].Time = seq.Duration+10; * Infolist.Properties [0].curves [2].Keys [3].Time =seq.Duration+10; * Infolist.Properties [1].curves [0].Keys[3].Time = seq.Duration+10; * Infolist.Properties [1].curves [1].Keys [3].Time = seq.Duration; * Infolist.Properties [1].curves [2].Keys [3].Time = seq.Duration+10; * Infolist.Properties [1].curves [3].Keys [3].Time = seq.Duration+10; * * Infolist.Properties [0].curves[0].Keys[2].Time=seq.Duration; * Infolist.Properties [0].curves [1].Keys [2].Time = seq.Duration; * Infolist.Properties [0].curves [2].Keys [2].Time = seq.Duration; * Infolist.Properties [1].curves [0].Keys[2].Time = seq.Duration; * Infolist.Properties [1].curves [1].Keys [2].Time = seq.Duration; * Infolist.Properties [1].curves [2].Keys [2].Time = seq.Duration; * Infolist.Properties [1].curves [3].Keys [2].Time = seq.Duration;*/ SetTimeLinePos(center + new Vector3(0, 0.0f, 0), TargetPos); SetEndPos = true; } } } } //<============================================== //< 미리 선작업을 진행해놓는다. //<============================================== if (list[i]._CutSceneEventData != null) { for (int j = 0; j < list[i]._CutSceneEventData.Length; j++) { for (int p = 0; p < list[i]._CutSceneEventData[j].EventList.Length; p++) { if (list[i]._CutSceneEventData[j].EventList[p].ActionType == eCutSceneEvent.CameraShake && Shaker == null) { Camera _camera = startRootObj.gameObject.AddComponent <Camera>(); _camera.clearFlags = CameraClearFlags.Nothing; _camera.cullingMask = 0; Shaker = startRootObj.AddComponent <Thinksquirrel.Utilities.CameraShake>(); Shaker.cameras.Add(_camera); } } } } } //< 위치 보정을 안했다면 여기서 해준다. (레이드가 아닐경우에만) if (!SetEndPos) { SetTimeLinePos(Vector3.zero, Vector3.zero, true); } USTimelineContainer[] list2 = seq.GetComponentsInChildren <USTimelineContainer>(); for (int i = 0; i < list2.Length; i++) { list2[i].AffectedObject = startCamObj.transform; } //< 카메라 위치를 변경함(포커스 카메라) G_GameInfo.GameInfo.FocusingCam.ChangeParent(startCamObj.transform); seq.PlaybackFinished = (sequence) => { G_GameInfo.GameInfo.StartCoroutine(ResetPosUpdate(CameraManager.instance.RtsCamera.transform.position, true)); //G_GameInfo.GameInfo.StartCoroutine(SetCutScene()); }; seq.Play(); //< 메인 카메라는 꺼줌 UIHelper.SetMainCameraActive(false); yield return(null); }