CanNotSwitchAttackTargetClass.cs 846 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanNotSwitchAttackTargetClass : ICardEffect, ICanNotSwitchAttackTargetEffect
  6. {
  7. Func<Permanent, bool> PermanentCondition { get; set; }
  8. public void SetUpCanNotSwitchAttackTargetClass(Func<Permanent, bool> PermanentCondition)
  9. {
  10. this.PermanentCondition = PermanentCondition;
  11. }
  12. public bool CanNotBeSwitchAttackTarget(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. }