public bool IsNextLowNumber(CardController other) => (int)Number == (int)other.Number - 1;
public bool IsNextHighNumber(CardController other) => (int)Number == (int)other.Number + 1;
public bool SameColor(CardController other) => Color == other.Color;
public bool DifferentColor(CardController other) => !SameColor(other);
public bool ValidDropPositionFor(CardController card) => card.Seed == _seed && !card.IsAPile() && ( (!HasCards && card.Number == Number.A) || (HasCards && TopCard.IsNextLowNumber(card)) );
public SolitaireMove(CardController cardToMove, IDragDropOrigin origin, IDragDropDestination destination) { _movedCard = cardToMove; _origin = origin; _destination = destination; }
protected void Unlink(CardController card) => card.Stack = null;
public void Drop(CardController card) { card.DropTo(_transform.position + _pileOffset); AttachNext(card.Pile); card.Stack = null; }
protected virtual void OnTake(CardController card) => Unlink(card);
protected void Link(CardController card) => card.Stack = this;
protected virtual void OnPut(CardController card) { card.PlaceTo(NextStackPosition); Link(card); }
public virtual void Put(CardController card) => _stack.Put(card);
public void UndoDrop(CardController card) => DetachNext();
public CardAnimator(CardController card, float movementAnimationTime = 0.2f, float rotationAnimationTime = 0.2f) { _card = card.transform; _movementAnimationTime = movementAnimationTime; _rotationAnimationTime = rotationAnimationTime; }
public void UndoDrop(CardController card) => Take();
private void Awake() { _tranform = transform; _card = GetComponent <CardController>(); _cam = Camera.main; }
public bool ValidDropPositionFor(CardController card) => Card.Stack?.GetType() != typeof(TalonStack) && !Next && Card.IsFacingUp && Card.DifferentColor(card) && Card.IsNextHighNumber(card);