Ejemplo n.º 1
0
        /// <summary>
        /// Construct a route node given type, parent game object, local position to parent and
        /// local rotation to parent.
        /// </summary>
        /// <param name="type">Node type.</param>
        /// <param name="parent">Parent game object - world if null.</param>
        /// <param name="localPosition">Position in parent frame. If parent is null this is the position in world frame.</param>
        /// <param name="localRotation">Rotation in parent frame. If parent is null this is the rotation in world frame.</param>
        /// <returns>Wire route node instance.</returns>
        public static WireRouteNode Create(Wire.NodeType type       = Wire.NodeType.BodyFixedNode,
                                           GameObject parent        = null,
                                           Vector3 localPosition    = default(Vector3),
                                           Quaternion localRotation = default(Quaternion))
        {
            WireRouteNode node = Create <WireRouteNode>(parent, localPosition, localRotation);

            node.Type = type;

            return(node);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add node to this route given type, parent, local position and local rotation.
        /// </summary>
        /// <param name="type">Node type.</param>
        /// <param name="parent">Node parent object.</param>
        /// <param name="localPosition">Local position relative parent.</param>
        /// <param name="localRotation">Local rotation relative parent.</param>
        /// <returns>Added route node.</returns>
        public WireRouteNode Add(Wire.NodeType type,
                                 GameObject parent        = null,
                                 Vector3 localPosition    = default(Vector3),
                                 Quaternion localRotation = default(Quaternion))
        {
            var node = WireRouteNode.Create(type, parent, localPosition, localRotation);

            if (!Add(node))
            {
                return(null);
            }

            return(node);
        }