CanNotBeDestroyedBySkillClass.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanNotBeDestroyedBySkillClass : ICardEffect, ICanNotBeDestroyedBySkillEffect
  6. {
  7. public void SetUpCanNotBeDestroyedBySkillClass(Func<Permanent, ICardEffect, bool> canNotBeDestroyedCondition)
  8. {
  9. _canNotBeDestroyedCondition = canNotBeDestroyedCondition;
  10. }
  11. Func<Permanent, ICardEffect, bool> _canNotBeDestroyedCondition { get; set; }
  12. public bool CanNotBeDestroyedBySkill(Permanent permanent, ICardEffect cardEffect)
  13. {
  14. if (permanent != null)
  15. {
  16. if (permanent.TopCard != null)
  17. {
  18. if (cardEffect != null)
  19. {
  20. if (_canNotBeDestroyedCondition != null)
  21. {
  22. if (_canNotBeDestroyedCondition(permanent, cardEffect))
  23. {
  24. return true;
  25. }
  26. }
  27. }
  28. }
  29. }
  30. return false;
  31. }
  32. }