CSComponent.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. namespace AtomicEngine
  5. {
  6. public delegate void AtomicEventDelegate (VariantMap eventData);
  7. public class CSComponent : Component
  8. {
  9. public uint ManagedID;
  10. public CSComponent ()
  11. {
  12. nativeInstance = NativeCore.RegisterNative (csb_Atomic_CSComponent_Constructor(), this);
  13. ComponentCore.RegisterCSComponent (this);
  14. }
  15. virtual public void Start()
  16. {
  17. }
  18. virtual public void Update(float timeStep)
  19. {
  20. }
  21. public void SendEvent(string eventType, Dictionary<string, object> eventData = null)
  22. {
  23. }
  24. public void SubscribeToEvent(AObject sender, string eventType, AtomicEventDelegate function)
  25. {
  26. EventCore.SubscribeToEvent (this, sender, eventType, function);
  27. }
  28. public void SubscribeToEvent(string eventType, AtomicEventDelegate function)
  29. {
  30. EventCore.SubscribeToEvent (this, null, eventType, function);
  31. }
  32. [DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
  33. private static extern IntPtr csb_Atomic_CSComponent_Constructor();
  34. }
  35. }