Component.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. /// <summary>
  6. /// Base class for all components. Components represent primary logic elements in the scene. They are attached to
  7. /// scene objects.
  8. /// </summary>
  9. public class Component : GameObject
  10. {
  11. // Internal use only
  12. protected Component()
  13. { }
  14. /// <summary>
  15. /// Returns the scene object this component is attached to.
  16. /// </summary>
  17. public SceneObject SceneObject
  18. {
  19. get { return Internal_GetSceneObject(mCachedPtr); }
  20. }
  21. [MethodImpl(MethodImplOptions.InternalCall)]
  22. internal static extern Component Internal_AddComponent(SceneObject parent, Type type);
  23. [MethodImpl(MethodImplOptions.InternalCall)]
  24. internal static extern Component Internal_GetComponent(SceneObject parent, Type type);
  25. [MethodImpl(MethodImplOptions.InternalCall)]
  26. internal static extern Component[] Internal_GetComponents(SceneObject parent);
  27. [MethodImpl(MethodImplOptions.InternalCall)]
  28. internal static extern Component Internal_RemoveComponent(SceneObject parent, Type type);
  29. [MethodImpl(MethodImplOptions.InternalCall)]
  30. internal static extern SceneObject Internal_GetSceneObject(IntPtr nativeInstance);
  31. }
  32. }