LogicComponent.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // LogicComponent.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// Helper base class for user-defined game logic components that hooks up to update events and forwards them to virtual functions similar to ScriptInstance class.
  21. /// </summary>
  22. public unsafe partial class LogicComponent : Component
  23. {
  24. unsafe partial void OnLogicComponentCreated ();
  25. [Preserve]
  26. public LogicComponent (IntPtr handle) : base (handle)
  27. {
  28. OnLogicComponentCreated ();
  29. }
  30. [Preserve]
  31. protected LogicComponent (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnLogicComponentCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int LogicComponent_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (LogicComponent_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr LogicComponent_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (LogicComponent_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int LogicComponent_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(LogicComponent));
  54. return new StringHash (LogicComponent_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr LogicComponent_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(LogicComponent));
  61. return Marshal.PtrToStringAnsi (LogicComponent_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public LogicComponent () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr LogicComponent_LogicComponent (IntPtr context);
  69. [Preserve]
  70. public LogicComponent (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(LogicComponent));
  73. handle = LogicComponent_LogicComponent ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnLogicComponentCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void LogicComponent_OnSetEnabled (IntPtr handle);
  79. /// <summary>
  80. /// Handle enabled/disabled state change. Changes update event subscription.
  81. /// </summary>
  82. public override void OnSetEnabled ()
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. LogicComponent_OnSetEnabled (handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void LogicComponent_Start (IntPtr handle);
  89. /// <summary>
  90. /// Called when the component is added to a scene node. Other components may not yet exist.
  91. /// </summary>
  92. public void Start ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. LogicComponent_Start (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void LogicComponent_DelayedStart (IntPtr handle);
  99. /// <summary>
  100. /// Called before the first update. At this point all other components of the node should exist. Will also be called if update events are not wanted; in that case the event is immediately unsubscribed afterward.
  101. /// </summary>
  102. public void DelayedStart ()
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. LogicComponent_DelayedStart (handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void LogicComponent_Stop (IntPtr handle);
  109. /// <summary>
  110. /// Called when the component is detached from a scene node, usually on destruction. Note that you will no longer have access to the node and scene at that point.
  111. /// </summary>
  112. public void Stop ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. LogicComponent_Stop (handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void LogicComponent_Update (IntPtr handle, float timeStep);
  119. /// <summary>
  120. /// Called on scene update, variable timestep.
  121. /// </summary>
  122. public void Update (float timeStep)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. LogicComponent_Update (handle, timeStep);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void LogicComponent_PostUpdate (IntPtr handle, float timeStep);
  129. /// <summary>
  130. /// Called on scene post-update, variable timestep.
  131. /// </summary>
  132. public void PostUpdate (float timeStep)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. LogicComponent_PostUpdate (handle, timeStep);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void LogicComponent_FixedUpdate (IntPtr handle, float timeStep);
  139. /// <summary>
  140. /// Called on physics update, fixed timestep.
  141. /// </summary>
  142. public void FixedUpdate (float timeStep)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. LogicComponent_FixedUpdate (handle, timeStep);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void LogicComponent_FixedPostUpdate (IntPtr handle, float timeStep);
  149. /// <summary>
  150. /// Called on physics post-update, fixed timestep.
  151. /// </summary>
  152. public void FixedPostUpdate (float timeStep)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. LogicComponent_FixedPostUpdate (handle, timeStep);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void LogicComponent_SetUpdateEventMask (IntPtr handle, byte mask);
  159. /// <summary>
  160. /// Set what update events should be subscribed to. Use this for optimization: by default all are in use. Note that this is not an attribute and is not saved or network-serialized, therefore it should always be called eg. in the subclass constructor.
  161. /// </summary>
  162. private void SetUpdateEventMask (byte mask)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. LogicComponent_SetUpdateEventMask (handle, mask);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern byte LogicComponent_GetUpdateEventMask (IntPtr handle);
  169. /// <summary>
  170. /// Return what update events are subscribed to.
  171. /// </summary>
  172. private byte GetUpdateEventMask ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return LogicComponent_GetUpdateEventMask (handle);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern bool LogicComponent_IsDelayedStartCalled (IntPtr handle);
  179. /// <summary>
  180. /// Return whether the DelayedStart() function has been called.
  181. /// </summary>
  182. private bool IsDelayedStartCalled ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return LogicComponent_IsDelayedStartCalled (handle);
  186. }
  187. public override StringHash Type {
  188. get {
  189. return UrhoGetType ();
  190. }
  191. }
  192. public override string TypeName {
  193. get {
  194. return GetTypeName ();
  195. }
  196. }
  197. [Preserve]
  198. public new static StringHash TypeStatic {
  199. get {
  200. return GetTypeStatic ();
  201. }
  202. }
  203. public new static string TypeNameStatic {
  204. get {
  205. return GetTypeNameStatic ();
  206. }
  207. }
  208. /// <summary>
  209. /// Return what update events are subscribed to.
  210. /// Or
  211. /// Set what update events should be subscribed to. Use this for optimization: by default all are in use. Note that this is not an attribute and is not saved or network-serialized, therefore it should always be called eg. in the subclass constructor.
  212. /// </summary>
  213. public byte UpdateEventMask {
  214. get {
  215. return GetUpdateEventMask ();
  216. }
  217. set {
  218. SetUpdateEventMask (value);
  219. }
  220. }
  221. /// <summary>
  222. /// Return whether the DelayedStart() function has been called.
  223. /// </summary>
  224. public bool DelayedStartCalled {
  225. get {
  226. return IsDelayedStartCalled ();
  227. }
  228. }
  229. }
  230. }