Entity.cs 814 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using UnityEngine;
  3. namespace FL.Battle
  4. {
  5. public abstract class Entity : IEntity, IDisposable
  6. {
  7. public int TableId { get; private set; }
  8. public int EntityId { get; private set; }
  9. public EntityAttributes Attr { get; private set; }
  10. public Vector3 TargetPosition { get; set; }
  11. public EEntityState State { get; set; }
  12. public void Init(int tableId, int entityId, EntityAttributes attr)
  13. {
  14. TableId = tableId;
  15. EntityId = entityId;
  16. Attr = attr;
  17. State = EEntityState.Idle;
  18. }
  19. void IDisposable.Dispose()
  20. {
  21. OnDispose();
  22. }
  23. public abstract EEntityType EntityType { get; }
  24. protected virtual void OnDispose()
  25. {
  26. }
  27. }
  28. }