BuffTimeoutEvent.cs 438 B

12345678910111213141516171819
  1. using Model;
  2. using MongoDB.Bson;
  3. namespace Controller
  4. {
  5. [Event(EventType.BuffTimeout, ServerType.City)]
  6. public class BuffTimeoutEvent: IEvent
  7. {
  8. public void Run(Env env)
  9. {
  10. Unit owner = World.Instance.GetComponent<UnitComponent>().Get(env.Get<ObjectId>(EnvKey.OwnerId));
  11. if (owner == null)
  12. {
  13. return;
  14. }
  15. owner.GetComponent<BuffComponent>().RemoveById(env.Get<ObjectId>(EnvKey.BuffId));
  16. }
  17. }
  18. }