public Color GetNodeColorByString(EPathNodeType nodeType) { switch (nodeType) { case EPathNodeType.walkable: return(Color.yellow); case EPathNodeType.jump: return(Color.blue); case EPathNodeType.fall: return(Color.black); case EPathNodeType.climb: return(Color.cyan); } return(Color.white); }
public float GetNodeWeightByString(EPathNodeType nodeType) { switch (nodeType) { case EPathNodeType.walkable: return(groundNode); case EPathNodeType.jump: return(jumpNode); case EPathNodeType.fall: return(fallNode); case EPathNodeType.climb: return(climbNode); case EPathNodeType.portal: return(portalNode); } return(0f); }
public override void Import(DCFG cfg) { MapPath data = cfg as MapPath; this.ID = data.ID; this.Type = (EPathNodeType)data.Type; this.PositionVary = data.PositionVary; this.RotationVary = data.RotationVary; for (int i = 0; i < data.PathNodes.Count; i++) { MapPathNode d = data.PathNodes[i]; FTPathNode p = new GameObject().AddComponent <FTPathNode>(); p.transform.parent = transform; p.Import(d); } }
public override void OnDrawInspector() { #if UNITY_EDITOR GUILayout.Space(10); this.ID = UnityEditor.EditorGUILayout.IntField("ID", this.ID); this.Type = (EPathNodeType)UnityEditor.EditorGUILayout.EnumPopup("Type", this.Type); this.PositionVary = UnityEditor.EditorGUILayout.Toggle("PositionVary", this.PositionVary); this.RotationVary = UnityEditor.EditorGUILayout.Toggle("RotationVary", this.RotationVary); if (GUILayout.Button("添加路点")) { AddElement(); } int index = -1; for (int i = 0; i < PathNodes.Count; i++) { FTPathNode node = PathNodes[i]; if (node == null) { continue; } GUILayout.BeginHorizontal(); GUILayout.Label(node.name); GUILayout.Label(node.Pos.ToString()); GUILayout.Label(node.Face.ToString()); GUI.color = Color.cyan; if (GUILayout.Button("I")) { InsElement(i); } GUI.color = Color.red; if (GUILayout.Button("X")) { index = i; } GUI.color = Color.white; GUILayout.EndHorizontal(); } if (index >= 0) { DelElement(index); } GUILayout.Space(5); #endif }
public static void DrawPathNodes(EPathNodeType type, List <FTPathNode> pathNodes) { #if UNITY_EDITOR if (pathNodes.Count < 2) { return; } UnityEditor.Handles.color = Color.green; for (int i = 0; i < pathNodes.Count; i++) { FTPathNode n1 = pathNodes[i]; if (n1 == null) { pathNodes.RemoveAt(i); break; } n1.name = string.Format("P {0}", i); FTDraw.DrawGizmosSphere(n1.transform, Color.green, 0.5f); FTDraw.DrawLabelIcon(n1.gameObject, 6); if (i < pathNodes.Count - 1) { FTPathNode n2 = pathNodes[i + 1]; if (n2 == null) { continue; } switch (type) { case EPathNodeType.Linear: UnityEditor.Handles.DrawBezier(n1.transform.position, n2.transform.position, n1.transform.position, n2.transform.position, Color.green, null, 2); break; case EPathNodeType.Bezier: UnityEditor.Handles.DrawBezier(n1.transform.position, n2.transform.position, n1.TangentOut, n2.TangentIn, Color.green, null, 2); break; } } } #endif }
public instructions(Vector3 position, EPathNodeType pOrder) { pos = position; order = pOrder; }
public pathNode(EPathNodeType typeOfNode, Vector3 position) { pos = position; type = typeOfNode; }