Ejemplo n.º 1
0
        public T CreateComponent <T> (StringHash type, CreateMode mode = CreateMode.Replicated, uint id = 0) where T : Component
        {
            Runtime.ValidateRefCounted(this);
            var ptr = Node_CreateComponent(handle, type.Code, mode, id);

            return(Runtime.LookupObject <T> (ptr));
        }
Ejemplo n.º 2
0
        public Node[] GetChildrenWithComponent <T> (bool recursive = false) where T : Component
        {
            Runtime.ValidateRefCounted(this);
            var stringhash = Runtime.LookupStringHash(typeof(T));
            int count;
            var ptr = NodeHelper.urho_node_get_components(handle, stringhash.Code, recursive ? 1 : 0, out count);

            if (ptr == IntPtr.Zero)
            {
                return(ZeroArray);
            }

            var res = new Node[count];

            for (int i = 0; i < count; i++)
            {
                var node = Marshal.ReadIntPtr(ptr, i * IntPtr.Size);
                res [i] = Runtime.LookupObject <Node> (node);
            }
            if (Component.IsDefinedInManagedCode <T>())
            {
                //is not really efficient, but underlying Urho3D knows nothing about components defined in C#
                return(res.Where(c => c.GetComponent <T>() != null).ToArray());
            }
            return(res);
        }
Ejemplo n.º 3
0
                public bool MoveNext()
                {
                    var count = VectorSharedPtr_Count(handle);

                    if (count < 1 || count <= index)
                    {
                        return(false);
                    }

                    current = Runtime.LookupObject <U>(VectorSharedPtr_GetIdx(handle, index));
                    index++;
                    return(true);
                }
Ejemplo n.º 4
0
Archivo: Node.cs Proyecto: corefan/urho
        public Node[] GetChildrenWithComponent <T> (bool recursive = false) where T : Component
        {
            var stringhash = Runtime.LookupStringHash(typeof(T));
            int count;
            var ptr = NodeHelper.urho_node_get_components(handle, stringhash.Code, recursive ? 1 : 0, out count);

            if (ptr == IntPtr.Zero)
            {
                return(ZeroArray);
            }

            var res = new Node[count];

            for (int i = 0; i < count; i++)
            {
                var node = Marshal.ReadIntPtr(ptr, i * IntPtr.Size);
                res [i] = Runtime.LookupObject <Node> (node);
            }
            return(res);
        }
Ejemplo n.º 5
0
        public Node[] GetChildrenWithTag(string tag, bool recursive = false)
        {
            Runtime.ValidateRefCounted(this);
            int count;
            var ptr = NodeHelper.Node_GetChildrenWithTag(handle, tag, recursive ? 1 : 0, out count);

            if (ptr == IntPtr.Zero)
            {
                return(ZeroArray);
            }

            var res = new Node[count];

            for (int i = 0; i < count; i++)
            {
                var node = Marshal.ReadIntPtr(ptr, i * IntPtr.Size);
                res [i] = Runtime.LookupObject <Node> (node);
            }

            return(res);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Return patch by index.
 /// </summary>
 public TerrainPatch GetPatch(uint index)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <TerrainPatch> (Terrain_GetPatch(handle, index)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Return material.
 /// </summary>
 private Material GetMaterial()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Material> (Terrain_GetMaterial(handle)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Return heightmap image.
 /// </summary>
 private Image GetHeightMap()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Image> (Terrain_GetHeightMap(handle)));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Return the scene associated with the material for shader parameter animation updates.
 /// </summary>
 private Scene GetScene()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Scene> (Material_GetScene(handle)));
 }
Ejemplo n.º 10
0
 public override T this[int idx] => Runtime.LookupObject <T>(VectorSharedPtr_GetIdx(handle, idx));
Ejemplo n.º 11
0
 static public Node get_Node(IntPtr handle, int stringHash)
 {
     return(Runtime.LookupObject <Node>(urho_map_get_ptr(handle, stringHash)));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Return model.
 /// </summary>
 private Model GetModel()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Model> (StaticModel_GetModel(handle)));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Return particle effect.
 /// </summary>
 private ParticleEffect GetEffect()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <ParticleEffect> (ParticleEmitter_GetEffect(handle)));
 }
Ejemplo n.º 14
0
 public Model Clone()
 {
     return(Runtime.LookupObject <Model> (Model_Clone(handle)));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Return the geometry for a specific LOD level.
 /// </summary>
 public override Geometry GetLodGeometry(uint batchIndex, uint level)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Geometry> (StaticModel_GetLodGeometry(handle, batchIndex, level)));
 }
Ejemplo n.º 16
0
 static public PhysicsWorld2D get_PhysicsWorld2D(IntPtr handle, int stringHash)
 {
     return(Runtime.LookupObject <PhysicsWorld2D>(urho_map_get_ptr(handle, stringHash)));
 }
Ejemplo n.º 17
0
 static public Obstacle get_Obstacle(IntPtr handle, int stringHash)
 {
     return(Runtime.LookupObject <Obstacle>(urho_map_get_ptr(handle, stringHash)));
 }
Ejemplo n.º 18
0
 static public UrhoObject get_Object(IntPtr handle, int stringHash)
 {
     return(Runtime.LookupObject <UrhoObject>(urho_map_get_ptr(handle, stringHash)));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Return patch by patch coordinates including neighbor terrains.
 /// </summary>
 public TerrainPatch GetNeighborPatch(int x, int z)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <TerrainPatch> (Terrain_GetNeighborPatch(handle, x, z)));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Return the background element.
 /// </summary>
 private BorderImage GetBackground()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <BorderImage> (UrhoConsole_GetBackground(handle)));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Return east neighbor terrain.
 /// </summary>
 private Terrain GetEastNeighbor()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Terrain> (Terrain_GetEastNeighbor(handle)));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Return the close butoon element.
 /// </summary>
 private Button GetCloseButton()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Button> (UrhoConsole_GetCloseButton(handle)));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Return material by geometry index.
 /// </summary>
 public Material GetMaterial(uint index)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Material> (StaticModel_GetMaterial(handle, index)));
 }
Ejemplo n.º 24
0
 static public NavigationMesh get_NavigationMesh(IntPtr handle, int stringHash)
 {
     return(Runtime.LookupObject <NavigationMesh>(urho_map_get_ptr(handle, stringHash)));
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Return the UI style file.
 /// </summary>
 private Urho.Resources.XmlFile GetDefaultStyle()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Urho.Resources.XmlFile> (UrhoConsole_GetDefaultStyle(handle)));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Return technique by index.
 /// </summary>
 public Technique GetTechnique(uint index)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Technique> (Material_GetTechnique(handle, index)));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Return the line edit element.
 /// </summary>
 private LineEdit GetLineEdit()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <LineEdit> (UrhoConsole_GetLineEdit(handle)));
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Return texture by unit.
 /// </summary>
 public Texture GetTexture(TextureUnit unit)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Texture> (Material_GetTexture(handle, unit)));
 }
Ejemplo n.º 29
0
Archivo: Zone.cs Proyecto: yrest/urho
 /// <summary>
 /// Return zone texture.
 /// </summary>
 private Texture GetZoneTexture()
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Texture> (Zone_GetZoneTexture(handle)));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Return shader parameter animation.
 /// </summary>
 public ValueAnimation GetShaderParameterAnimation(string name)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <ValueAnimation> (Material_GetShaderParameterAnimation(handle, name)));
 }