Unit.cs 613 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using MongoDB.Bson.Serialization.Attributes;
  2. using PF;
  3. namespace ETModel
  4. {
  5. public enum UnitType
  6. {
  7. Hero,
  8. Npc
  9. }
  10. [ObjectSystem]
  11. public class UnitSystem : AwakeSystem<Unit, UnitType>
  12. {
  13. public override void Awake(Unit self, UnitType a)
  14. {
  15. self.Awake(a);
  16. }
  17. }
  18. public sealed class Unit: Entity
  19. {
  20. public UnitType UnitType { get; private set; }
  21. [BsonIgnore]
  22. public Vector3 Position { get; set; }
  23. public void Awake(UnitType unitType)
  24. {
  25. this.UnitType = unitType;
  26. }
  27. public override void Dispose()
  28. {
  29. if (this.IsDisposed)
  30. {
  31. return;
  32. }
  33. base.Dispose();
  34. }
  35. }
  36. }