Unit.cs 500 B

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