// public void OnMove() { // if (clickTarget != null) {//取消按下事件, click事件无效 // GameObject nowTarget = ClickScene(); // if (nowTarget != clickTarget) { // EventMultiArgs args = new EventMultiArgs(); // args.AddArg("target", clickTarget); // EventSystem.CallEvent(EventID.PRESS_CANCEL_SCENE_TARGET, args, true); // clickTarget = null; // } // } // } public MovePathMono AddCameraPath(string pathName, bool willResetPos = true, DragCameraByPath.EDragType eType = DragCameraByPath.EDragType.MOMENTUM, List <float> listPagePoint = null) { if (movePath != null && movePath.PathName == pathName) { return(null); } GameObject camObj = _sceneCamera; if (camObj == null) { return(null); } //movePath = camObj.GetComponent<MovePathMono>(); //if (movePath != null) // RemoveCameraPath(); movePath = camObj.AddComponent <MovePathMono>(); movePath.CreatePath(pathName); SetCameraDragble(movePath, fCurCameraPos, eType, listPagePoint);//给镜头拖动表现指定轨迹 if (willResetPos) { sceneCamera.transform.position = movePath.GetPointAtTime(fCurCameraPos); movePath.UpdateRotation(); OnDragScene(fCurCameraPos); } return(movePath); }
public override void OnInspectorGUI() { MovePathMono mpm = target as MovePathMono; serializedObject.Update(); NGUIEditorTools.SetLabelWidth(110f); GUILayout.Label("Path Name: " + mpm.PathName); GUILayout.Space(1f); //NGUIEditorTools.DrawProperty("Path Name", serializedObject, "pathName"); SerializedProperty sp = NGUIEditorTools.DrawProperty("Path Type", serializedObject, "ePathType"); MovePathMono.ECameraPathType pathType = (MovePathMono.ECameraPathType)sp.intValue; if (pathType == MovePathMono.ECameraPathType.Straightline) { NGUIEditorTools.DrawProperty("Point Begin", serializedObject, "pointBegin"); NGUIEditorTools.DrawProperty("Point End", serializedObject, "pointEnd"); } else if (pathType == MovePathMono.ECameraPathType.Bezier || pathType == MovePathMono.ECameraPathType.Arcline || pathType == MovePathMono.ECameraPathType.Circle) { NGUIEditorTools.DrawProperty("Point Begin", serializedObject, "pointBegin"); NGUIEditorTools.DrawProperty("Point End", serializedObject, "pointEnd"); NGUIEditorTools.DrawProperty("Point Param", serializedObject, "pointParam"); } else if (pathType == MovePathMono.ECameraPathType.CylinderSpirals) { NGUIEditorTools.DrawProperty("Point Begin", serializedObject, "pointBegin"); NGUIEditorTools.DrawProperty("Point Param1", serializedObject, "pointParam"); NGUIEditorTools.DrawProperty("Point Param2", serializedObject, "pointParam2"); NGUIEditorTools.DrawProperty("Distance", serializedObject, "Distance"); NGUIEditorTools.DrawProperty("PerCircleDistance", serializedObject, "PerCircleDistance"); } SerializedProperty spLookat = NGUIEditorTools.DrawProperty("Look At Type", serializedObject, "elookAtType"); MovePathMono.ELookAtType lookAtType = (MovePathMono.ELookAtType)spLookat.intValue; if (lookAtType == MovePathMono.ELookAtType.None) { } else if (lookAtType == MovePathMono.ELookAtType.LookAtPoint || lookAtType == MovePathMono.ELookAtType.LookAtPointReverse) { NGUIEditorTools.DrawProperty("Point Look At", serializedObject, "pointLookAt1"); } else if (lookAtType == MovePathMono.ELookAtType.LookAtLine || lookAtType == MovePathMono.ELookAtType.LookAtLineReverse) { NGUIEditorTools.DrawProperty("Point Look At Begin", serializedObject, "pointLookAt1"); NGUIEditorTools.DrawProperty("Point Look At End", serializedObject, "pointLookAt2"); NGUIEditorTools.DrawProperty("Point Look At Offset", serializedObject, "PosLookAtOffset"); } else if (lookAtType == MovePathMono.ELookAtType.LookAtTwoPoints) { NGUIEditorTools.DrawProperty("Point Look At Begin", serializedObject, "pointLookAt1"); NGUIEditorTools.DrawProperty("Point Look At End", serializedObject, "pointLookAt2"); } serializedObject.ApplyModifiedProperties(); }
public void RemoveCameraPath() { GameObject camObj = GameSceneManager.sceneCameraObj; if (camObj != null && movePath != null) { Destroy(movePath); movePath = null; } }
public void AddAllPathToCamera(GameObject camObj) { init(); foreach (KeyValuePair <string, PathConfig> keyValue in dicPathCofig) { string pathName = keyValue.Key; MovePathMono movePath = camObj.AddComponent <MovePathMono>(); movePath.CreatePath(pathName); movePath.enabled = false; } }
public void SetCameraDragble(MovePathMono _moveMono, float curPos, DragCameraByPath.EDragType eType = DragCameraByPath.EDragType.MOMENTUM, List <float> listPagePoint = null) { //_dragPath = _sceneCamera.GetComponent<DragCameraByPath>(); if (_dragPath == null) { _dragPath = _sceneCamera.AddComponent <DragCameraByPath>(); } _dragPath.SetMovePath(_moveMono);//给镜头拖动表现指定轨迹 _dragPath._onDragEvent = OnDragScene; _dragPath._bDragDirReverse = bDragDirReverse; _dragPath._dragType = eType; _dragPath._pageViewPoints.Clear(); _dragPath._curCameraPos = curPos; if (listPagePoint != null) { for (int i = 0; i < listPagePoint.Count; i++) { _dragPath._pageViewPoints.Add(listPagePoint[i]); } } }
public MovePathMono AddCameraPath(string pathName, PathConfig config, DragCameraByPath.EDragType eType = DragCameraByPath.EDragType.MOMENTUM, List <float> listPagePoint = null) { GameObject camObj = _sceneCamera; if (camObj == null) { return(null); } movePath = camObj.GetComponent <MovePathMono>(); if (movePath != null) { RemoveCameraPath(); } movePath = camObj.AddComponent <MovePathMono>(); movePath.CreatePath(pathName, config); sceneCamera.transform.position = movePath.GetPointAtTime(fCurCameraPos); movePath.UpdateRotation(); SetCameraDragble(movePath, fCurCameraPos, eType, listPagePoint);//给镜头拖动表现指定轨迹 OnDragScene(fCurCameraPos); return(movePath); }
public void SetMovePath(MovePathMono path) { _movePath = path; }