SceneObject.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. // TODO - Unfinished
  6. public sealed class SceneObject : GameObject
  7. {
  8. public SceneObject parent
  9. {
  10. set { Internal_SetParent(mCachedPtr, value); }
  11. get { return Internal_GetParent(mCachedPtr); }
  12. }
  13. public Vector3 position
  14. {
  15. set { throw new NotImplementedException(); }
  16. get { throw new NotImplementedException(); }
  17. }
  18. public Vector3 localPosition
  19. {
  20. set { throw new NotImplementedException(); }
  21. get { throw new NotImplementedException(); }
  22. }
  23. public Quaternion rotation
  24. {
  25. set { throw new NotImplementedException(); }
  26. get { throw new NotImplementedException(); }
  27. }
  28. public Quaternion localRotation
  29. {
  30. set { throw new NotImplementedException(); }
  31. get { throw new NotImplementedException(); }
  32. }
  33. public Vector3 scale
  34. {
  35. set { throw new NotImplementedException(); }
  36. get { throw new NotImplementedException(); }
  37. }
  38. // For internal use
  39. private SceneObject()
  40. {
  41. }
  42. public SceneObject(string name)
  43. {
  44. Internal_CreateInstance(this, name);
  45. }
  46. public T AddComponent<T>() where T : Component
  47. {
  48. return (T)Component.Internal_AddComponent(this, typeof (T));
  49. }
  50. public T GetComponent<T>() where T : Component
  51. {
  52. return (T)Component.Internal_GetComponent(this, typeof(T));
  53. }
  54. public Component[] GetComponents()
  55. {
  56. return Component.Internal_GetComponents(this);
  57. }
  58. public void RemoveComponent<T>() where T : Component
  59. {
  60. Component.Internal_RemoveComponent(this, typeof(T));
  61. }
  62. public int GetNumChildren()
  63. {
  64. return Internal_GetNumChildren(mCachedPtr);
  65. }
  66. public SceneObject GetChild(int idx)
  67. {
  68. return Internal_GetChild(mCachedPtr, idx);
  69. }
  70. [MethodImpl(MethodImplOptions.InternalCall)]
  71. private static extern void Internal_CreateInstance(SceneObject instance, string name);
  72. [MethodImpl(MethodImplOptions.InternalCall)]
  73. private static extern void Internal_SetParent(IntPtr nativeInstance, SceneObject parent);
  74. [MethodImpl(MethodImplOptions.InternalCall)]
  75. private static extern SceneObject Internal_GetParent(IntPtr nativeInstance);
  76. [MethodImpl(MethodImplOptions.InternalCall)]
  77. private static extern int Internal_GetNumChildren(IntPtr nativeInstance);
  78. [MethodImpl(MethodImplOptions.InternalCall)]
  79. private static extern SceneObject Internal_GetChild(IntPtr nativeInstance, int idx);
  80. }
  81. }