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)); }
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); }
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); }
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); }
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); }
/// <summary> /// Return patch by index. /// </summary> public TerrainPatch GetPatch(uint index) { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <TerrainPatch> (Terrain_GetPatch(handle, index))); }
/// <summary> /// Return material. /// </summary> private Material GetMaterial() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Material> (Terrain_GetMaterial(handle))); }
/// <summary> /// Return heightmap image. /// </summary> private Image GetHeightMap() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Image> (Terrain_GetHeightMap(handle))); }
/// <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))); }
public override T this[int idx] => Runtime.LookupObject <T>(VectorSharedPtr_GetIdx(handle, idx));
static public Node get_Node(IntPtr handle, int stringHash) { return(Runtime.LookupObject <Node>(urho_map_get_ptr(handle, stringHash))); }
/// <summary> /// Return model. /// </summary> private Model GetModel() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Model> (StaticModel_GetModel(handle))); }
/// <summary> /// Return particle effect. /// </summary> private ParticleEffect GetEffect() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <ParticleEffect> (ParticleEmitter_GetEffect(handle))); }
public Model Clone() { return(Runtime.LookupObject <Model> (Model_Clone(handle))); }
/// <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))); }
static public PhysicsWorld2D get_PhysicsWorld2D(IntPtr handle, int stringHash) { return(Runtime.LookupObject <PhysicsWorld2D>(urho_map_get_ptr(handle, stringHash))); }
static public Obstacle get_Obstacle(IntPtr handle, int stringHash) { return(Runtime.LookupObject <Obstacle>(urho_map_get_ptr(handle, stringHash))); }
static public UrhoObject get_Object(IntPtr handle, int stringHash) { return(Runtime.LookupObject <UrhoObject>(urho_map_get_ptr(handle, stringHash))); }
/// <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))); }
/// <summary> /// Return the background element. /// </summary> private BorderImage GetBackground() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <BorderImage> (UrhoConsole_GetBackground(handle))); }
/// <summary> /// Return east neighbor terrain. /// </summary> private Terrain GetEastNeighbor() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Terrain> (Terrain_GetEastNeighbor(handle))); }
/// <summary> /// Return the close butoon element. /// </summary> private Button GetCloseButton() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Button> (UrhoConsole_GetCloseButton(handle))); }
/// <summary> /// Return material by geometry index. /// </summary> public Material GetMaterial(uint index) { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Material> (StaticModel_GetMaterial(handle, index))); }
static public NavigationMesh get_NavigationMesh(IntPtr handle, int stringHash) { return(Runtime.LookupObject <NavigationMesh>(urho_map_get_ptr(handle, stringHash))); }
/// <summary> /// Return the UI style file. /// </summary> private Urho.Resources.XmlFile GetDefaultStyle() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Urho.Resources.XmlFile> (UrhoConsole_GetDefaultStyle(handle))); }
/// <summary> /// Return technique by index. /// </summary> public Technique GetTechnique(uint index) { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Technique> (Material_GetTechnique(handle, index))); }
/// <summary> /// Return the line edit element. /// </summary> private LineEdit GetLineEdit() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <LineEdit> (UrhoConsole_GetLineEdit(handle))); }
/// <summary> /// Return texture by unit. /// </summary> public Texture GetTexture(TextureUnit unit) { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Texture> (Material_GetTexture(handle, unit))); }
/// <summary> /// Return zone texture. /// </summary> private Texture GetZoneTexture() { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <Texture> (Zone_GetZoneTexture(handle))); }
/// <summary> /// Return shader parameter animation. /// </summary> public ValueAnimation GetShaderParameterAnimation(string name) { Runtime.ValidateRefCounted(this); return(Runtime.LookupObject <ValueAnimation> (Material_GetShaderParameterAnimation(handle, name))); }