CanSuspendByDigisorptionClass.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanSuspendByDigisorptionClass : ICardEffect, ICanSuspendByDigisorptionEffect
  6. {
  7. public void SetUpCanSuspendByDigisorptionClass(Func<Permanent, bool> PermanentCondition, Func<ICardEffect, bool> CardEffectCondition, Func<bool> _CheckAvailability)
  8. {
  9. this.PermanentCondition = PermanentCondition;
  10. this.CardEffectCondition = CardEffectCondition;
  11. this._CheckAvailability = _CheckAvailability;
  12. }
  13. Func<Permanent, bool> PermanentCondition { get; set; }
  14. Func<ICardEffect, bool> CardEffectCondition { get; set; }
  15. Func<bool> _CheckAvailability { get; set; }
  16. public bool canSuspendDigisorption(Permanent permanent, ICardEffect cardEffect)
  17. {
  18. if (permanent != null)
  19. {
  20. if (permanent.TopCard != null)
  21. {
  22. if (cardEffect != null)
  23. {
  24. if (PermanentCondition != null)
  25. {
  26. if (CardEffectCondition != null)
  27. {
  28. if (PermanentCondition(permanent))
  29. {
  30. if (CardEffectCondition(cardEffect))
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. public bool isCheckAvailability()
  43. {
  44. if (_CheckAvailability != null)
  45. {
  46. return _CheckAvailability();
  47. }
  48. return false;
  49. }
  50. }