Unit.cs 550 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Numerics;
  2. namespace Model
  3. {
  4. public enum UnitType
  5. {
  6. Hero,
  7. Npc
  8. }
  9. [ObjectEvent]
  10. public class UnitEvent : ObjectEvent<Unit>, IAwake<UnitType>
  11. {
  12. public void Awake(UnitType unitType)
  13. {
  14. this.Get().Awake(unitType);
  15. }
  16. }
  17. public sealed class Unit: Entity
  18. {
  19. public UnitType UnitType { get; private set; }
  20. public Vector3 Position;
  21. public void Awake(UnitType unitType)
  22. {
  23. this.UnitType = unitType;
  24. }
  25. public override void Dispose()
  26. {
  27. if (this.Id == 0)
  28. {
  29. return;
  30. }
  31. base.Dispose();
  32. }
  33. }
  34. }