private void Awake() { if (instance == null) { instance = this; } }
public void OnDestroy() { if (instance == this) { instance = null; } }
public void OnSceneGUI() { CameraMotion MotionScr = target as CameraMotion; if (MotionScr && MotionScr.create == true) { Quaternion rot = Quaternion.identity; for (int element = 0; element < MotionScr.pointsList.Count; element++) { points p; p = (points)MotionScr.pointsList [element]; float size = HandleUtility.GetHandleSize(MotionScr.ConvertToVector3(p.point)) * 0.2f; MotionScr.pointsList [element] = new points(p.tag, Handles.FreeMoveHandle(MotionScr.ConvertToVector3(p.point), rot, size, Vector3.zero, Handles.SphereCap), p.name); } for (int element = 0; element < MotionScr.pointsList.Count - 1; element += 3) { points p, p1; p = (points)MotionScr.pointsList [element]; p1 = (points)MotionScr.pointsList [element + 1]; Handles.DrawLine(MotionScr.ConvertToVector3(p.point), MotionScr.ConvertToVector3(p1.point)); } for (int element = 3; element < MotionScr.pointsList.Count; element += 3) { points p, p1; p = (points)MotionScr.pointsList [element]; p1 = (points)MotionScr.pointsList [element - 1]; Handles.DrawLine(MotionScr.ConvertToVector3(p.point), MotionScr.ConvertToVector3(p1.point)); } } if (GUI.changed) { EditorUtility.SetDirty(target); MotionScr.change = true; } }
public void Update() { Point cursor = GameCursor.Position; _cameraMotion = CameraMotion.None; if (cursor.X == 0) { _position.X -= _speed; _cameraMotion = CameraMotion.Left; } else if (cursor.X == Game.ScreenWidth - 1) { _position.X += _speed; _cameraMotion = CameraMotion.Right; } if (cursor.Y == 0) { _position.Y -= _speed; _cameraMotion = CameraMotion.Up; } else if (cursor.Y == Game.ScreenHeight - 1) { _position.Y += _speed; _cameraMotion = CameraMotion.Down; } }
public CameraMotion ReadCameraMotion(BinaryReader reader, bool motionReadAlready = false) { if (!motionReadAlready) { Read(reader); } var ret = new CameraMotion(); var cameraMotionNum = reader.ReadInt32(); Dictionary <int, CameraKeyframe> keyframes = new Dictionary <int, CameraKeyframe>(); for (var i = 0; i < cameraMotionNum; ++i) { var nFrame = reader.ReadInt32(); var focalLength = reader.ReadSingle(); var position = MmdReaderUtil.ReadVector3(reader); var rotation = MmdReaderUtil.ReadVector3(reader); var interpolator = reader.ReadBytes(24); var fov = reader.ReadUInt32(); var orthographic = reader.ReadByte(); var keyframe = new CameraKeyframe { Fov = fov, FocalLength = focalLength, Orthographic = orthographic != 0, Position = position, Rotation = rotation, Interpolation = interpolator }; keyframes[nFrame] = keyframe; } var frameList = keyframes.Select(entry => entry).ToList().OrderBy(kv => kv.Key).ToList(); ret.KeyFrames = frameList; return(ret); }
public static CameraMotion Create() { CameraMotion model = (CameraMotion)ScriptableObject.CreateInstance <CameraMotion>(); model.name = InitialName; return(model); }
/// <summary> /// Gets the translated motion for the X axis. /// </summary> /// <param name="motion">The motion.</param> /// <returns>The translated motion.</returns> public static CameraMotion TranslatedX(this CameraMotion motion) { return(motion switch { CameraMotion.Left => CameraMotion.Right, CameraMotion.Right => CameraMotion.Left, _ => motion, });
public void Handle(ICommand command) { switch (command) { case MoveCameraCommand moveCommand: CurrentMotion = moveCommand.Direction; break; } }
// Start is called before the first frame update void Start() { tm = FindObjectOfType <TelemetryManager>(); cm = FindObjectOfType <CameraMotion>(); batteryUI = GameObject.FindGameObjectWithTag("batteryUI").transform; velocityUI = GameObject.FindGameObjectWithTag("velocityUI").transform; stateUI = GameObject.FindGameObjectWithTag("stateUI").transform; rotationUI = GameObject.FindGameObjectWithTag("rotationUI").transform; }
//Camera表格信息提取 public bool CameraAdd(DataRow camera_row, string id) { bool isRight = true; CameraInfoManager cameraMana = new CameraInfoManager(); CameraMotion cameraExcel = cameraMana.CameraInfoGet(camera_row, id, ref isRight); if (!isRight) { return(false); } _motionList.Add(cameraExcel); simpleID.Add(simpleID.Count, id); return(true); }
public bool LoadCameraMotion(string path) { if (path == null) { _cameraMotion = null; return(false); } _cameraMotion = new VmdReader().ReadCameraMotion(path); if (_cameraMotion.KeyFrames.Count == 0) { return(false); } ResetMotion(); return(true); }
public void SwitchToBattleResultCamera() { EB.Debug.Log("[CombatCamera]SwitchToBattleResultCamera"); DisableBlurEffect(); CameraMotion motion = GlobalCameraMotionData.Instance.GetCameraMotion(m_battleResultCameraData); if (motion != null) { List <GameObject> targets = new List <GameObject>(); targets.Add(m_skill_select_lookat_locator); GameCameraParams gameCameraParams = (GameCameraParams)motion.camera; CameraLerp motion_lerp = motion.cameraLerpOverride; EnterInteractionCamera(ref targets, ref gameCameraParams, motion_lerp); } }
void SetCameraMotion(UIA3Automation automation, CameraMotion cameraMotion) { if (cameraMotion == CameraMotion.autoDetect) { return; } var window2 = app.GetMainWindow(automation); var comboBoxes = window2.FindAllDescendants(cf => cf.ByControlType(ControlType.ComboBox)).Select(x => x.AsComboBox()); var cameraActionSelect = comboBoxes.FirstOrDefault(x => x.Items.Length > 0 && x.Items[0].Name == "Auto-detect"); if (cameraActionSelect != null) { var descAttr = GetAttribute <DescriptionAttribute>(cameraMotion); cameraActionSelect.Select(descAttr.Description); } }
private void Update() { switch (currentMotion) { case CameraMotion.idle: playIdle(Time.time); break; case CameraMotion.shake: playShake(Time.time - lastChange); break; case CameraMotion.swap: playSwapPlayers(Time.time - lastChange); break; case CameraMotion.direction: playDirection(Time.time - lastChange); break; case CameraMotion.gravity: playGravity(Time.time - lastChange); break; } if (Time.time - lastChange > 1) { currentMotion = CameraMotion.idle; } }
public void OnTeamsVictoryListener() { if (!string.IsNullOrEmpty(m_teamsSpawnCameraData) && m_teams_victory_lookat_locator != null) { CameraMotion motion = GlobalCameraMotionData.Instance.GetCameraMotion(m_teamsSpawnCameraData); if (motion != null) { try { // stop lerp back DOTween.KillAll(true); } catch (System.IndexOutOfRangeException e) { EB.Debug.LogError(e.ToString()); } _runningBehaviors.Clear(); List <GameObject> targets = new List <GameObject>(); targets.Add(m_teams_victory_lookat_locator); GameCameraParams gameCameraParams = (GameCameraParams)motion.camera; if (gameCameraParams == null) { Debug.LogError("OnTeamsVictoryListener gameCameraParams is null"); } CameraLerp motion_lerp = motion.cameraLerpOverride; if (motion_lerp == null) { Debug.LogError("OnTeamsVictoryListener motion_lerp is null"); } else { motion_lerp.dialogueCameraLerpTime = 5f; motion_lerp.hangonTime = int.MaxValue; } EnterInteractionCamera(ref targets, ref gameCameraParams, motion_lerp); } } }
// Use this for initialization void Start() { joystick = GameObject.Find("MoveJoystick"); joystickBind = joystick.GetComponent <JoystickBind>(); if (!joystickBind.getBinded()) { etcJoystick = joystick.GetComponent <ETCJoystick>(); robotMotion = gameObject.GetComponent <RobotMotion>(); etcJoystick.onMove.AddListener(robotMotion.JoystickMove); etcJoystick.onTouchStart.AddListener(robotMotion.JoystickMoveStart); etcJoystick.onTouchUp.AddListener(robotMotion.JoysitckMoveEnd); mainCamera = GameObject.Find("Main Camera"); cameraMotion = mainCamera.GetComponent <CameraMotion>(); cameraMotion.Robot = gameObject; minimapCamera = GameObject.Find("MinimapCamera"); minimapMotion = minimapCamera.GetComponent <MinimapMotion>(); minimapMotion.Robot = gameObject; joystickBind.bindJoystick(); } }
private void buttonOpenZMO_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "ZMO Files (*.ZMO)|*.ZMO"; openFileDialog.InitialDirectory = ContentManager.GetRootPath(); if (openFileDialog.ShowDialog() == DialogResult.OK) { this.camMotion = new CameraMotion(this.panelPreview.GraphicsDevice); this.camMotion.Load(openFileDialog.FileName, ClientType.IROSE); this.labelMotionName.Text = "Motion name : " + openFileDialog.SafeFileName; this.numericUpDownFPS.Value = this.camMotion.GetFPS(); this.panelPreview.SetCameraMotion(this.camMotion); this.DisplayFrames(); this.frameContextMenuStrip.Enabled = true; this.addMenuItem.Enabled = true; this.removeMenuItem.Enabled = true; this.setCurrentPositionMenuItem.Enabled = true; this.copyMenuItem.Enabled = true; this.pasteMenuItem.Enabled = true; this.interpolationMenuItem.Enabled = true; } }
private void buttonNewZMO_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "ZMO Files (*.ZMO)|*.ZMO"; saveFileDialog.AddExtension = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { this.camMotion = new CameraMotion(this.panelPreview.GraphicsDevice); List <CameraMotion.Frame> frames = this.camMotion.GetFrames(); for (int i = 0; i < 5; i++) { frames.Add(new CameraMotion.Frame { cameraPosition = new Vector3(5200f, 5200f, 20f), LookAt = new Vector3(5200f, 5201f, 20f), Up = new Vector3(0f, 1f, 0f) }); } this.camMotion.motionFile = new ZMO(); this.numericUpDownFPS.Value = 30m; this.camMotion.motionFile.FPS = 30; this.camMotion.motionFile.Path = saveFileDialog.FileName; this.camMotion.GenerateVertices(); this.camMotion.GenerateViewMatrices(); this.panelPreview.SetCameraMotion(this.camMotion); this.DisplayFrames(); this.labelMotionName.Text = "Motion name : " + saveFileDialog.FileName; this.frameContextMenuStrip.Enabled = true; this.addMenuItem.Enabled = true; this.removeMenuItem.Enabled = true; this.setCurrentPositionMenuItem.Enabled = true; this.copyMenuItem.Enabled = true; this.pasteMenuItem.Enabled = true; this.interpolationMenuItem.Enabled = true; } }
public override void OnMouseMove(int positionX, int positionY) { Point point = _camera.ScreenToPoint(new Point(positionX, positionY)); if (_choseBox.IsChosing) { _choseBox.SetBox(positionX, positionY); } CameraMotion type = _camera.GetMotion(); if (type != CameraMotion.None) { GameCursor.SetType((CursorType)Enum.Parse(typeof(CursorType), type.ToString())); } else if (_commandTable.ContainCursor(point)) { GameCursor.SetType(_commandTable.IsGettingTarget, false); } else { _map.OnMouseMove(point); GameCursor.SetType(_commandTable.IsGettingTarget, _map.CursorUnit != null); } }
void Start() { // Se obtienen las referencias a los componentes del objeto. objUserMotionController = objUser.GetComponent<MotionController>(); objAIMotionController = objAI.GetComponent<MotionController>(); objAIStatus = objAI.GetComponent<Status>(); objUsrAttack = objUser.GetComponent<Attack>(); // Referencias a los componentes de la cámara cameraMotion = GetComponent<CameraMotion>(); // Relación de aspecto entre la resolución de pantalla real y las resolución de referencia. vGUIScale = new Vector3( Screen.width / (iWidthScreen * 1.0f), Screen.height / (iHeightScreen * 1.0f), 1); bEndGame = false; fEndTime = 0.0f; if (PlayerPrefs.HasKey( sGamesWon) == false) // Se inicializa el número de partidas ganadas. PlayerPrefs.SetInt( sGamesWon, 0); }
public void Compose(string[] images, CameraMotion cameraMotion, Action <string> onEvent = null, Action <int> onProgress = null, bool saveProject = false) { this.onEvent = onEvent; this.onProgress = onProgress; var appStr = ConfigurationManager.AppSettings["ICE-app-path"]; var appName = Path.GetFileName(appStr); var exportBtnLabel = ConfigurationManager.AppSettings["Export-btn-label"]; var exportToDiskBtnLabel = ConfigurationManager.AppSettings["ExportToDisk-btn-label"]; var cameraMotionLabel = ConfigurationManager.AppSettings["CameraMotion-btn-label"]; var exportPanoramaBtnLabel = ConfigurationManager.AppSettings["ExportPanorama-btn-label"]; var saveBtnLabel = ConfigurationManager.AppSettings["Save-btn-label"]; var saveProjectLabel = ConfigurationManager.AppSettings["Save-project-label"]; int saveWait = int.Parse(ConfigurationManager.AppSettings["Save-wait"]); var imgStr = string.Join(" ", images); var processStartInfo = new ProcessStartInfo(fileName: appStr, arguments: imgStr); var app = FlaUI.Core.Application.Launch(processStartInfo); using (var automation = new UIA3Automation()) { string title = null; Window window = null; do { try { app = FlaUI.Core.Application.Attach(appName); window = app.GetMainWindow(automation); title = window.Title; OnEvent("Opened :" + title); } catch (Exception) { title = null; } } while (string.IsNullOrWhiteSpace(title)); OnEvent("files :" + imgStr); if (cameraMotion != CameraMotion.autoDetect) { var window2 = app.GetMainWindow(automation); var comboBoxes = window.FindAllDescendants(cf => cf.ByControlType(ControlType.ComboBox)).Select(x => x.AsComboBox()); var cameraActionSelect = comboBoxes.FirstOrDefault(x => x.Items.Length > 0 && x.Items[0].Name == "Auto-detect"); if (cameraActionSelect != null) { var descAttr = GetAttribute <DescriptionAttribute>(cameraMotion); cameraActionSelect.Select(descAttr.Description); } } try { AutomationElement button1 = null; do { button1 = window.FindFirstDescendant(cf => cf.ByText(exportBtnLabel)); if (button1 == null) { OnEvent("."); } } while (button1 == null); if (button1.ControlType != ControlType.Button) { button1 = button1.AsButton().Parent; } button1?.AsButton().Invoke(); bool finished = false; OnEvent("composing."); do { var window2 = app.GetMainWindow(automation); var button2 = window.FindFirstDescendant(cf => cf.ByText(exportToDiskBtnLabel)); title = window2.Title; finished = button2 != null && title.StartsWith("U"); int percent = 0; if (!finished) { var percentStr = title.Substring(0, 2); var numStr = percentStr[1] == '%' ? percentStr.Substring(0, 1) : percentStr; if (int.TryParse(numStr, out percent)) { onProgress?.Invoke(percent); } } } while (!finished); } catch (Exception ex) { OnEvent(ex.Message); } try { var button2 = window.FindFirstDescendant(cf => cf.ByText(exportToDiskBtnLabel)); if (button2 != null && button2.ControlType != ControlType.Button) { button2 = button2.AsButton().Parent; } button2?.AsButton().Invoke(); OnEvent("exporting to disk..."); } catch (Exception ex) { OnEvent(ex.Message); } try { Thread.Sleep(1000); var saveDlg = window.ModalWindows.Length == 1 ? window.ModalWindows[0] : window.ModalWindows.FirstOrDefault(w => w.Name == exportPanoramaBtnLabel); var buttonSave = saveDlg.FindFirstDescendant(cf => cf.ByText(saveBtnLabel)).AsButton(); buttonSave?.Invoke(); Thread.Sleep(saveWait); if (saveProject) { window.Close(); var onCloseDlg = window.ModalWindows[0]; var buttonOnCloseSave = onCloseDlg.FindFirstDescendant(cf => cf.ByText(saveBtnLabel)).AsButton(); buttonOnCloseSave?.Invoke(); var saveProjectDlg = window.ModalWindows[0]; var projectName = saveProjectDlg.FindFirstDescendant(cf => cf.ByControlType(ControlType.ComboBox)).AsComboBox(); projectName.EditableText = Path.GetFileNameWithoutExtension(images[0]); var buttonSaveProjectSave = saveProjectDlg.FindFirstDescendant(cf => cf.ByText(saveBtnLabel)).AsButton(); buttonSaveProjectSave?.Invoke(); //var buttonSaveProj = window.FindFirstDescendant(cf => cf.ByText(saveProjectLabel)); //if (buttonSaveProj != null && buttonSaveProj.ControlType != ControlType.Button) // buttonSaveProj = buttonSaveProj.AsButton().Parent; //var saveProj = buttonSaveProj?.AsButton(); //if (saveProj.IsEnabled) // buttonSaveProj?.AsButton().Invoke(); OnEvent("saving project..."); } } catch (Exception ex) { OnEvent(ex.Message); } } app.Kill(); app = null; }
/// <summary> /// Gets a boolean value that indicates if motion is on the Y axis /// </summary> /// <param name="motion">The motion.</param> /// <returns>true if Y axis motion (up / down); otherwise, false.</returns> public static bool IsY(this CameraMotion motion) { return(motion == CameraMotion.Up || motion == CameraMotion.Down); }
/// <summary> /// Gets a boolean value that indicates if motion is on the X axis /// </summary> /// <param name="motion">The motion.</param> /// <returns>true if X axis motion (left / right); otherwise, false.</returns> public static bool IsX(this CameraMotion motion) { return(motion == CameraMotion.Left || motion == CameraMotion.Right); }
public override void OnInspectorGUI() { CameraMotion MotionScr = target as CameraMotion; if (MotionScr.target == null) { EditorGUILayout.HelpBox("The target is not assigned!", MessageType.Warning); } if (MotionScr.change) { EditorGUILayout.HelpBox("Curve not saved!", MessageType.Warning); } DrawDefaultInspector(); if (MotionScr.pointsList.Count == 0) { if (GUILayout.Button("Create curve")) { MotionScr.change = true; MotionScr.create = true; MotionScr.curveCount++; MotionScr.selectButton = 0; MotionScr.pointsList.Clear(); MotionScr.pointsList.Add(new points("EndPointForCam", MotionScr.transform.position, curveNameConst)); MotionScr.pointsList.Add(new points("MiddlePointForCam", MotionScr.transform.position, "")); MotionScr.pointsList.Add(new points("MiddlePointForCam", MotionScr.transform.position, "")); MotionScr.pointsList.Add(new points("EndPointForCam", MotionScr.transform.position, curveNameConst)); } } else { if (GUILayout.Button("Add curve!")) { MotionScr.change = true; MotionScr.curveCount++; MotionScr.pointsList.Add(new points("MiddlePointForCam", MotionScr.ConvertToVector3(MotionScr.pointsList [MotionScr.pointsList.Count - 1].point), "")); MotionScr.pointsList.Add(new points("MiddlePointForCam", MotionScr.ConvertToVector3(MotionScr.pointsList [MotionScr.pointsList.Count - 1].point), "")); MotionScr.pointsList.Add(new points("EndPointForCam", MotionScr.ConvertToVector3(MotionScr.pointsList [MotionScr.pointsList.Count - 1].point), curveNameConst)); } } if (MotionScr.change) { if (GUILayout.Button("Save")) { MotionScr.Save(); MotionScr.change = false; } } EditorGUILayout.BeginVertical(); if (MotionScr.create) { for (int element = 0, element2 = 1; element < MotionScr.pointsList.Count - 1; element += 3, element2++) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(MotionScr.pointsList [element].name + " " + (element2)); if (MotionScr.selectButton == element) { buttonWidth = 18; buttonHeight = 20; } else { buttonWidth = 25; buttonHeight = 20; } if (GUILayout.Button("S", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { MotionScr.selectButton = element; } if (GUILayout.Button("X", GUILayout.Width(25), GUILayout.Height(20))) { if (element == MotionScr.pointsList.Count - 4 && element != 0) { MotionScr.pointsList.RemoveAt(element + 1); MotionScr.pointsList.RemoveAt(element + 1); MotionScr.pointsList.RemoveAt(element + 1); if (MotionScr.selectButton == element) { MotionScr.selectButton -= 3; } } else if (element != MotionScr.pointsList.Count - 4 && element != 0) { MotionScr.pointsList.RemoveAt(element); MotionScr.pointsList.RemoveAt(element); MotionScr.pointsList.RemoveAt(element); } else { MotionScr.pointsList.Clear(); MotionScr.create = false; } MotionScr.curveCount--; MotionScr.change = true; } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); } } EditorGUILayout.EndVertical(); if (MotionScr.create) { if (GUILayout.Button("Reset")) { MotionScr.pointsList.Clear(); MotionScr.create = false; MotionScr.curveCount = 0; MotionScr.change = true; } } }
public void SetCameraMotion(CameraMotion camMotion) { this.cameraMotion = camMotion; }
public CameraInfoManager() { _cameraMotion = new CameraMotion(); }
public CameraInfoManager () { _cameraMotion = new CameraMotion(); }
void Start() { // Se obtienen las referencias a los componentes del objeto. objUserMotionController = objUser.GetComponent<MotionController>(); objAIMotionController = objAI.GetComponent<MotionController>(); objAIStatus = objAI.GetComponent<Status>(); objUsrAttack = objUser.GetComponent<Attack>(); // Referencias a los componentes de la cámara cameraMotion = GetComponent<CameraMotion>(); // Relación de aspecto entre la resolución de pantalla real y las resolución de referencia. vGUIScale = new Vector3( Screen.width / (iWidthScreen * 1.0f), Screen.height / (iHeightScreen * 1.0f), 1); }
public void Play() { _played = true; //CameraMotionEventProperties info = _event._cameraMotionProperties; //if(info._motionTarget == CameraMotionTarget.OriginView) //{ //m_target_pos = CameraMotionPreviewManager.Instance.OriginPos; //m_target_angle = CameraMotionPreviewManager.Instance.OriginAngle; //} //else { //Vector3 pos_offset = info._posOffset; //if(info._useLocalOffset) //{ //m_target_pos = _focusObject.transform.TransformPoint(pos_offset); //} //else //{ //m_target_pos = _focusObject.transform.position + pos_offset; //} //m_target_angle = info._targetAngle; } //CombatCamera combat_camera = CameraMotionPreviewManager.Instance._previewCamera; //if(combat_camera != null) //{ // //combat_camera.OnCameraMotion(m_target_pos, m_target_angle, info._lerpCurve, info._lerpDuration); //} MoveEditor.CameraMotionEventInfo info = _event; MoveEditor.CameraMotionEventProperties motionProps = info._cameraMotionProperties; //if (motionProps._motionTrigger == MoveEditor.CameraMotionTrigger.LocalPlayerOnly) //{ // if (Index.TeamIndex != CombatLogic.Instance.LocalPlayerTeamIndex) // { // return; // } //} //else if (motionProps._motionTrigger == MoveEditor.CameraMotionTrigger.EnemyOnly) //{ // if (CombatLogic.Instance.IsPlayerOrChallengerSide(Data.TeamId)) // { // return; // } // //if (!Data.IsEnemy) // //{ // // return; // //} //} if (Camera.main != null) { CombatCamera combat_camera = Camera.main.GetComponent <CombatCamera>(); //if (!combat_camera.m_enablePlayerOrChallengerMotion && CombatLogic.Instance.IsPlayerOrChallengerSide(Index.TeamIndex)) //{ // return; //} //if (!combat_camera.m_enableOpponentMotion && CombatLogic.Instance.IsOpponentSide(Index.TeamIndex)) //{ // return; //} string camera_motion_json = motionProps._motionOptions; List <MoveEditor.CameraMotionOption> options = GM.JSON.ToObject <List <MoveEditor.CameraMotionOption> >(camera_motion_json); List <GameObject> targets = new List <GameObject>(); if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.Attacker) { targets.Add(_previewGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.Defenders) { targets.Add(_previewHitGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.All) { targets.Add(_previewGameObject); targets.Add(_previewHitGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.DefendersCameraAnchor) { //Debug.LogError("现在不支持DefendersCameraAnchor这种类型"); //GameObject anchor = CombatEventReceiver.Instance.defenderSide.Find(CombatEventReceiver.Instance.defenderFormation + "/f2").gameObject; //if (anchor != null) //{ // targets.Add(anchor); //} //else //{ // EB.Debug.LogError("Combatant.OnCameraMotion Can not find DefendersCameraAnchor GameObject"); // return; //} } if (combat_camera != null) { if (motionProps._blendCurrentCamera) { if (motionProps._onlyLookAtTarget) { combat_camera.CurrentCameraLookAt(ref targets, motionProps._hangonDuration); } else { CameraLerp lerp = CameraLerp.Create(); lerp.lerpStyle = CameraLerp.LerpStyle.determineAtRunTime; lerp.dialogueCameraLerpSmoothing = motionProps._blendLerpSmoothing; lerp.animationCurve = motionProps._blendLerpCurve; lerp.dialogueCameraLerpTime = motionProps._lerpDuration; lerp.pitchLerpSmoothing = motionProps._blendPitchLerpSmoothing; lerp.curvePitchLerp = motionProps._blendPitchLerpCurve; lerp.yawLerpSmoothing = motionProps._blendYawLerpSmoothing; lerp.curveYawLerp = motionProps._blendYawLerpCurve; lerp.hangonTime = motionProps._hangonDuration; combat_camera.BlendCurrentCamera(ref targets, motionProps._blendDistanceOffset, motionProps._blendPitchOffset, motionProps._blendYawOffset, motionProps._blendHeightOffset, lerp); } } else { //int count = options.Count; MoveEditor.CameraMotionOption option = MoveEditor.MoveUtils.GetCamermotionLottery(ref options, false); if (option != null) { //Debug.LogError("OnCameraMotion != null cbt=" + Data.ToString()); CameraMotion motion = GlobalCameraMotionData.Instance.GetCameraMotion(option._motionName); if (motion != null) { combat_camera.State = CombatCamera.MotionState.Lerping; //MyFollowCamera.Instance.isActive = false; GameCameraParams gameCameraParams = (GameCameraParams)motion.camera; CameraLerp motion_lerp = motion.cameraLerpOverride; motion_lerp.dialogueCameraLerpTime = motionProps._lerpDuration; motion_lerp.hangonTime = motionProps._hangonDuration; combat_camera.EnterInteractionCamera(ref targets, ref gameCameraParams, motion_lerp); } } } } } }
//摄像机运动模块 private IEnumerator CameraCoroutine(string came_str, DataTable camera_table) { string[] cameArray = came_str.Split('|'); float camera_time = 0f; for(int i = 0; i < cameArray.Length; i++){ string cameKeyStr = InterData.CmdCheck(cameArray[i], "CAMERA"); if(cameKeyStr != ""){ //摄像机运动信息提取 DataRow cameRowData = camera_table.Rows.Find(cameKeyStr); //ID获取CAMERA行失败 if(cameRowData == null){ MotionPara.shouldStop = stopInRow; if(MotionPara.isEditor){ Debug.LogError(ErrorLocation.Locate("MAIN", "CAMERA", MotionPara.mainRowNumber) + ", CAMERA 没有这个ID!"); } continue; } bool isRight = true; CameraInfoManager tempInfoManager = new CameraInfoManager(); cameraAdministrator = tempInfoManager.CameraInfoGet(cameRowData, cameKeyStr, ref isRight); if(!isRight){ MotionPara.shouldStop = stopInRow; yield break; } if (!computeTime) { cameraAdministrator.Init(); cameraFlag = true; startTime = 0; MotionPara.MotionActive = true; cameraAdministrator.State = CurrentState.Active; yield return StartCoroutine(CameraTimer()); } else { cameraAdministrator.Init(); camera_time += cameraAdministrator.StandardTime; cameraAdministrator.PostProcess(); } }else{ MotionPara.shouldStop = stopInRow; //编辑器模式下会出现警报信息 if(MotionPara.isEditor){ Debug.LogError(ErrorLocation.Locate("MAIN", "CAMERA", MotionPara.mainRowNumber)); } } } if (computeTime) { cameraTime = camera_time; } yield return null; }