示例#1
0
        /// <summary>
        /// Converts a RouteNodeEventType to a string representation.
        /// </summary>
        /// <param name="eventType">RouteNodeEventType to convert.</param>
        /// <returns>String representation of eventType.</returns>
        public static string EventTypeToString(RouteNodeEventType eventType)
        {
            var typeString = eventType.ToString();

            if (typeString.StartsWith("Unknown"))
            {
                return(typeString.Remove(0, 7));
            }
            return(typeString);
        }
示例#2
0
        /// <summary>
        /// Create a new RouteNodeEvent.
        /// </summary>
        /// <param name="parent">GameObject parent to own the event.</param>
        public static RouteNodeEvent CreateNewNodeEvent(RouteNode parent, RouteNodeEventType type)
        {
            var go = new GameObject();

            go.transform.position = parent.transform.position;
            go.transform.SetParent(parent.transform);

            UnitySceneUtils.Select(go);
            SceneView.lastActiveSceneView.FrameSelected();

            var routeEvent = go.AddComponent <RouteNodeEvent>();

            routeEvent.Type = type;
            go.name         = GenerateEventName(EventTypeToString(routeEvent.Type), parent.Events.Count);
            return(routeEvent);
        }