public agxWire.Wire GetWire(agx.Uuid uuid)
 {
     agxWire.Wire wire;
     if (m_wires.TryGetValue(uuid, out wire))
     {
         return(wire);
     }
     return(null);
 }
 public agxCollide.Geometry GetGeometry(agx.Uuid uuid)
 {
     agxCollide.Geometry geometry;
     if (m_geometries.TryGetValue(uuid, out geometry))
     {
         return(geometry);
     }
     return(null);
 }
 public agx.RigidBody GetRigidBody(agx.Uuid uuid)
 {
     agx.RigidBody rb;
     if (m_bodies.TryGetValue(uuid, out rb))
     {
         return(rb);
     }
     return(null);
 }
 public agx.ContactMaterial GetContactMaterial(agx.Uuid uuid)
 {
     agx.ContactMaterial contactMaterial;
     if (m_contactMaterials.TryGetValue(uuid, out contactMaterial))
     {
         return(contactMaterial);
     }
     return(null);
 }
 public agx.Frame GetAssembly(agx.Uuid uuid)
 {
     agx.Frame frame;
     if (m_assemblies.TryGetValue(uuid, out frame))
     {
         return(frame);
     }
     return(null);
 }
 public agxCable.Cable GetCable(agx.Uuid uuid)
 {
     agxCable.Cable cable;
     if (m_cables.TryGetValue(uuid, out cable))
     {
         return(cable);
     }
     return(null);
 }
 public agx.Material GetMaterial(agx.Uuid uuid)
 {
     agx.Material material;
     if (m_materials.TryGetValue(uuid, out material))
     {
         return(material);
     }
     return(null);
 }
 public agx.Constraint GetConstraint(agx.Uuid uuid)
 {
     agx.Constraint constraint;
     if (m_constraints.TryGetValue(uuid, out constraint))
     {
         return(constraint);
     }
     return(null);
 }
 public agxCollide.Shape GetShape(agx.Uuid uuid)
 {
     agxCollide.Shape shape;
     if (m_shapes.TryGetValue(uuid, out shape))
     {
         return(shape);
     }
     return(null);
 }
Exemple #10
0
 public agx.ObserverFrame GetObserverFrame(agx.Uuid uuid)
 {
     agx.ObserverFrame observerFrame;
     if (m_observerFrames.TryGetValue(uuid, out observerFrame))
     {
         return(observerFrame);
     }
     return(null);
 }
Exemple #11
0
        public GameObject GetGameObject(agx.Uuid uuid)
        {
            GameObject go;

            if (m_gameObjects.TryGetValue(uuid, out go))
            {
                return(go);
            }
            return(null);
        }
        public Node GetNode(agx.Uuid uuid)
        {
            Node node;

            if (m_nodeCache.TryGetValue(uuid, out node))
            {
                return(node);
            }
            return(null);
        }
Exemple #13
0
        public void Ref(agx.Uuid uuid)
        {
            if (!m_gameObjects.ContainsKey(uuid))
            {
                Debug.LogWarning($"Unable to reference object with UUID: {uuid}");
                return;
            }

            m_gameObjects[uuid].RefCount += 1;
        }
        private Node GetOrCreateNode(NodeType type, agx.Uuid uuid, bool isRoot, Action onCreate)
        {
            if (m_nodeCache.ContainsKey(uuid))
            {
                return(m_nodeCache[uuid]);
            }

            onCreate();

            return(CreateNode(type, uuid, isRoot));
        }
Exemple #15
0
        private Node CreateNode(NodeType type, agx.Uuid uuid, bool isRoot)
        {
            Node node = new Node()
            {
                Type = type,
                Uuid = uuid
            };

            if (isRoot)
            {
                if (type == NodeType.Constraint)
                {
                    m_constraintRoot.AddChild(node);
                }
                else if (type == NodeType.Material)
                {
                    m_materialRoot.AddChild(node);
                }
                else if (type == NodeType.ContactMaterial)
                {
                    m_contactMaterialRoot.AddChild(node);
                }
                else if (type == NodeType.Wire)
                {
                    m_wireRoot.AddChild(node);
                }
                else if (type == NodeType.Cable)
                {
                    m_cableRoot.AddChild(node);
                }
                else if (type == NodeType.ObserverFrame)
                {
                    m_observerFrameRoot.AddChild(node);
                }
                else if (m_roots.FindIndex(n => n.Uuid == uuid) >= 0)
                {
                    Debug.LogError("Node already present as root.");
                }
                else
                {
                    m_roots.Add(node);
                }
            }

            m_nodeCache.Add(uuid, node);

            return(node);
        }
Exemple #16
0
        public GameObject GetOrCreateGameObject(agx.Uuid uuid)
        {
            DbData data;

            if (m_gameObjects.TryGetValue(uuid, out data))
            {
                data.RefCount += 1;
                return(data.GameObject);
            }

            data = new DbData()
            {
                GameObject = new GameObject(), RefCount = 1
            };
            data.GameObject.AddComponent <Uuid>().Native = uuid;

            m_gameObjects.Add(uuid, data);

            ++m_statistics.NumAddedGameObjects;

            return(data.GameObject);
        }
Exemple #17
0
 public Uuid(agx.Uuid uuid)
 {
     m_str = uuid.str();
 }