CanNotBeDestroyedClass.cs 816 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanNotBeDestroyedClass : ICardEffect, ICanNotBeDestroyedEffect
  6. {
  7. Func<Permanent, bool> _permanentCondition { get; set; }
  8. public void SetUpCanNotBeDestroyedClass(Func<Permanent, bool> permanentCondition)
  9. {
  10. _permanentCondition = permanentCondition;
  11. }
  12. public bool CanNotBeDestroyed(Permanent permanent)
  13. {
  14. if (permanent != null)
  15. {
  16. if (permanent.TopCard != null)
  17. {
  18. if (_permanentCondition != null)
  19. {
  20. if (_permanentCondition(permanent))
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. }
  27. return false;
  28. }
  29. }