Example #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));
        }
Example #2
0
        public Subscription SubscribeToEvent(StringHash eventName, Action <EventDataContainer> handler)
        {
            var s = new Subscription(ptr => handler(new EventDataContainer(ptr)));

            s.UnmanagedProxy = urho_subscribe_event(handle, ObjectCallbackInstance, GCHandle.ToIntPtr(s.gch), eventName.Code);
            return(s);
        }
Example #3
0
 public BoneWrapper GetBoneSafe(StringHash nameHash)
 {
     Runtime.ValidateObject(this);
     unsafe
     {
         Bone *result = Skeleton_GetBone0(handle, nameHash.Code);
         if (result == null)
         {
             return(null);
         }
         return(new BoneWrapper(this, result));
     }
 }
Example #4
0
 /// <summary>
 /// Return animation state by animation name hash.
 /// </summary>
 public AnimationState GetAnimationState(StringHash animationNameHash)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupRefCounted <AnimationState> (AnimatedModel_GetAnimationState7(handle, animationNameHash.Code)));
 }
Example #5
0
 /// <summary>
 /// Remove an animation by animation name hash.
 /// </summary>
 public void RemoveAnimationState(StringHash animationNameHash)
 {
     Runtime.ValidateRefCounted(this);
     AnimatedModel_RemoveAnimationState1(handle, animationNameHash.Code);
 }
Example #6
0
 /// <summary>
 /// Remove a subsystem.
 /// </summary>
 public void RemoveSubsystem(StringHash objectType)
 {
     Runtime.ValidateRefCounted(this);
     Context_RemoveSubsystem(handle, objectType.Code);
 }
Example #7
0
 /// <summary>
 /// Return object type name from hash, or empty if unknown.
 /// </summary>
 public string GetTypeName(StringHash objectType)
 {
     Runtime.ValidateRefCounted(this);
     return(Marshal.PtrToStringAnsi(Context_GetTypeName(handle, objectType.Code)));
 }
Example #8
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, Matrix3x4 value)
 {
     Runtime.ValidateRefCounted(this);
     Context_SetGlobalVar8(handle, key.Code, ref value);
 }
Example #9
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, IntVector2 value)
 {
     Runtime.ValidateRefCounted(this);
     Context_SetGlobalVar5(handle, key.Code, ref value);
 }
Example #10
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, float value)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_SetGlobalVar10(handle, key.Code, value);
 }
Example #11
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, Matrix4 value)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_SetGlobalVar7(handle, key.Code, ref value);
 }
Example #12
0
 /// <summary>
 /// Send event to all subscribers.
 /// </summary>
 public void SendEvent(StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_SendEvent(handle, eventType.Code);
 }
Example #13
0
 /// <summary>
 /// Unsubscribe from a specific sender's event.
 /// </summary>
 public void UnsubscribeFromEvent(Urho.UrhoObject sender, StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_UnsubscribeFromEvent2(handle, (object)sender == null ? IntPtr.Zero : sender.Handle, eventType.Code);
 }
Example #14
0
 /// <summary>
 /// Unsubscribe from an event.
 /// </summary>
 public void UnsubscribeFromEvent(StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_UnsubscribeFromEvent(handle, eventType.Code);
 }
Example #15
0
 /// <summary>
 /// Subscribe to a specific sender's event.
 /// </summary>
 public void SubscribeToEvent(Urho.UrhoObject sender, StringHash eventType, IntPtr handler)
 {
     Runtime.ValidateRefCounted(this);
     UrhoObject_SubscribeToEvent1(handle, (object)sender == null ? IntPtr.Zero : sender.Handle, eventType.Code, handler);
 }
Example #16
0
 /// <summary>
 /// Return animation track by name hash.
 /// </summary>
 public AnimationTrack *GetTrack(StringHash nameHash)
 {
     Runtime.ValidateRefCounted(this);
     return(Animation_GetTrack0(handle, nameHash.Code));
 }
Example #17
0
 /// <summary>
 /// Return subsystem by type.
 /// </summary>
 public Urho.UrhoObject GetSubsystem(StringHash type)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupRefCounted <Urho.UrhoObject> (Context_GetSubsystem(handle, type.Code)));
 }
Example #18
0
 /// <summary>
 /// Return whether has subscribed to an event without specific sender.
 /// </summary>
 public bool HasSubscribedToEvent(StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     return(UrhoObject_HasSubscribedToEvent(handle, eventType.Code));
 }
Example #19
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, Quaternion value)
 {
     Runtime.ValidateRefCounted(this);
     Context_SetGlobalVar6(handle, key.Code, ref value);
 }
Example #20
0
 /// <summary>
 /// Return whether has subscribed to a specific sender's event.
 /// </summary>
 public bool HasSubscribedToEvent(Urho.UrhoObject sender, StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     return(UrhoObject_HasSubscribedToEvent3(handle, (object)sender == null ? IntPtr.Zero : sender.Handle, eventType.Code));
 }
Example #21
0
 /// <summary>
 /// Set global variable with the respective key and value
 /// </summary>
 public void SetGlobalVar(StringHash key, string value)
 {
     Runtime.ValidateRefCounted(this);
     Context_SetGlobalVar11(handle, key.Code, value);
 }
Example #22
0
 /// <summary>
 /// Check current instance is type of specified type.
 /// </summary>
 public bool IsInstanceOf(StringHash type)
 {
     Runtime.ValidateRefCounted(this);
     return(UrhoObject_IsInstanceOf(handle, type.Code));
 }
Example #23
0
 /// <summary>
 /// Create an object by type hash. Return pointer to it or null if no factory found.
 /// </summary>
 public UrhoObject CreateObject(StringHash objectType)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupRefCounted <UrhoObject> (Context_CreateObject(handle, objectType.Code)));
 }
Example #24
0
 /// <summary>
 /// Return vertex morph by name hash.
 /// </summary>
 public ModelMorph *GetMorph(StringHash nameHash)
 {
     Runtime.ValidateRefCounted(this);
     return(Model_GetMorph1(handle, nameHash.Code));
 }
Example #25
0
 /// <summary>
 /// Copy base class attributes to derived class.
 /// </summary>
 public void CopyBaseAttributes(StringHash baseType, StringHash derivedType)
 {
     Runtime.ValidateRefCounted(this);
     Context_CopyBaseAttributes(handle, baseType.Code, derivedType.Code);
 }
Example #26
0
 /// <summary>
 /// Return event receivers for a sender and event type, or null if they do not exist.
 /// </summary>
 public EventReceiverGroup GetEventReceivers(Urho.UrhoObject sender, StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupRefCounted <EventReceiverGroup> (Context_GetEventReceivers(handle, (object)sender == null ? IntPtr.Zero : sender.Handle, eventType.Code)));
 }
Example #27
0
 /// <summary>
 /// Set vertex morph weight by name hash.
 /// </summary>
 public void SetMorphWeight(StringHash nameHash, float weight)
 {
     Runtime.ValidateRefCounted(this);
     AnimatedModel_SetMorphWeight5(handle, nameHash.Code, weight);
 }
Example #28
0
 /// <summary>
 /// Return event receivers for an event type, or null if they do not exist.
 /// </summary>
 public EventReceiverGroup GetEventReceivers(StringHash eventType)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupRefCounted <EventReceiverGroup> (Context_GetEventReceivers0(handle, eventType.Code)));
 }
Example #29
0
 /// <summary>
 /// Return vertex morph weight by name hash.
 /// </summary>
 public float GetMorphWeight(StringHash nameHash)
 {
     Runtime.ValidateRefCounted(this);
     return(AnimatedModel_GetMorphWeight10(handle, nameHash.Code));
 }
Example #30
0
 /// <summary>
 /// Return a node user variable name, or empty if not registered.
 /// </summary>
 public string GetVarName(StringHash hash)
 {
     Runtime.ValidateRefCounted(this);
     return(Marshal.PtrToStringAnsi(Scene_GetVarName(handle, hash.Code)));
 }