/// <summary> /// isStartFromCurPos:为true时表示创建的路径将以当前镜头位置为起点; 为false时表示完全按配置好的路径创建。 /// </summary> /// <param name="name"></param> /// <param name="isStartFromCurPos"></param> public void CreatePath(string name, bool isStartFromCurPos = false) { PathConfig config = new PathConfig(); if (!PathXMLMgr.getInstance().GetPath(name, ref config)) { return; } CreatePath(name, config, isStartFromCurPos); }
public void SavePathToXML() { if (isDisabled) { return; } if (!isNeedToSave) { return; } PathConfig pathConfig = new PathConfig(); pathConfig.pathType = (int)ePathType; pathConfig.pointBegin = posBegin; pathConfig.pointEnd = posEnd; if (ePathType == ECameraPathType.Straightline) { } else if (ePathType == ECameraPathType.Arcline) { pathConfig.pointParam1 = posParam; } else if (ePathType == ECameraPathType.Bezier) { pathConfig.pointParam1 = posParam; } else if (ePathType == ECameraPathType.Circle) { pathConfig.pointParam1 = posParam; } else if (ePathType == ECameraPathType.CylinderSpirals) { pathConfig.pointParam1 = posParam; pathConfig.pointParam2 = posParam2; pathConfig.distance = distance; pathConfig.perCircleDistance = perCircleDistance; if (Mathf.Abs(distance) < 0.01f || Mathf.Abs(perCircleDistance) < 0.01f) { return; } } if (elookAtType == ELookAtType.LookAtPoint) { pathConfig.lookAtType = 1; pathConfig.pointLookAt1 = posLookAt1; } else if (elookAtType == ELookAtType.LookAtLine) { pathConfig.lookAtType = 2; pathConfig.pointLookAt1 = posLookAt1; pathConfig.pointLookAt2 = posLookAt2; pathConfig.pointLookAtOffset = posLookAtOffset; } else if (elookAtType == ELookAtType.LookAtPointReverse) { pathConfig.lookAtType = 3; pathConfig.pointLookAt1 = posLookAt1; } else if (elookAtType == ELookAtType.LookAtLineReverse) { pathConfig.lookAtType = 4; pathConfig.pointLookAt1 = posLookAt1; pathConfig.pointLookAt2 = posLookAt2; pathConfig.pointLookAtOffset = posLookAtOffset; } else if (elookAtType == ELookAtType.LookAtTwoPoints) { pathConfig.lookAtType = 5; pathConfig.pointLookAt1 = posLookAt1; pathConfig.pointLookAt2 = posLookAt2; } pathConfig.pointBegin = posBegin; PathXMLMgr.getInstance().updatePath(pathName, pathConfig); PathXMLMgr.getInstance().WriteXML(); Utils.LogSys.Log("Saved Camera Path!"); }