void ClickedOnFoundation(Transform foundation) { if (lastClickedFoundation) { lastClickedFoundation.GetComponent <FoundationScript>().Declick(); } lastClickedFoundation = foundation.gameObject; clickedFoundationScript = lastClickedFoundation.GetComponent <FoundationScript>(); }
public int GetIncreaseOnNextCycle() { int output = 0; foreach (GameObject foundation in Config.config.foundations) { FoundationScript currentFoundationScript = foundation.GetComponent <FoundationScript>(); if (currentFoundationScript.cardList.Count != 0) { CardScript topCardScript = currentFoundationScript.cardList[0].GetComponent <CardScript>(); if (topCardScript.cardSuit == suit) { output += topCardScript.cardVal; } } } return(output); }
private void SelectMultipleCards(GameObject inputCard) { CardScript inputCardScript = inputCard.GetComponent <CardScript>(); if (inputCardScript == null || !inputCardScript.container.CompareTag("Foundation")) { throw new System.ArgumentException("inputCard must be a gameObject that contains a CardScript that is from a foundation"); } FoundationScript inputCardFoundation = inputCardScript.container.GetComponent <FoundationScript>(); for (int i = inputCardFoundation.cardList.IndexOf(inputCard); i >= 0; i--) { selectedCards.Add(inputCardFoundation.cardList[i]); inputCardFoundation.cardList[i].GetComponent <CardScript>().SetSelected(true); } StartDragging(); }
public void MoveCard(GameObject destination, bool doLog = true, bool isAction = true, bool isCycle = false, bool isStack = false, bool showHolo = true) { bool nextCardWasHidden = false; if (container.CompareTag("Foundation")) { if (doLog) { FoundationScript foundationScript = container.GetComponent <FoundationScript>(); if (foundationScript.cardList.Count > 1 && foundationScript.cardList[1].GetComponent <CardScript>().IsHidden) { nextCardWasHidden = true; } } container.GetComponent <FoundationScript>().RemoveCard(gameObject, showHolo: showHolo); } else if (container.CompareTag("Reactor")) { container.GetComponent <ReactorScript>().RemoveCard(gameObject); } else if (container.CompareTag("Wastepile")) { if (!doLog || destination.CompareTag("Deck")) { container.GetComponent <WastepileScript>().RemoveCard(gameObject, undoingOrDeck: true, showHolo: showHolo); } else { container.GetComponent <WastepileScript>().RemoveCard(gameObject, showHolo: showHolo); } } else if (container.CompareTag("Deck")) { container.GetComponent <DeckScript>().RemoveCard(gameObject); } else if (container.CompareTag("MatchedPile")) { container.GetComponent <MatchedPileScript>().RemoveCard(gameObject); } else if (container.CompareTag("LoadPile")) { container.GetComponent <LoadPileScript>().RemoveCard(gameObject); } if (destination.CompareTag("Foundation")) { if (doLog) { if (isStack) { UndoScript.undoScript.LogMove("stack", gameObject, isAction, nextCardWasHidden); } else { UndoScript.undoScript.LogMove("move", gameObject, isAction, nextCardWasHidden); } } destination.GetComponent <FoundationScript>().AddCard(gameObject, showHolo: showHolo); } else if (destination.CompareTag("Reactor")) { if (doLog) { if (isCycle) { UndoScript.undoScript.LogMove("cycle", gameObject, true, nextCardWasHidden); } else { UndoScript.undoScript.LogMove("move", gameObject, isAction, nextCardWasHidden); } } destination.GetComponent <ReactorScript>().AddCard(gameObject); } else if (destination.CompareTag("Wastepile")) { if (doLog) { if (container.CompareTag("Foundation")) // for undoing a match that goes into the wastepile { UndoScript.undoScript.LogMove("move", gameObject, isAction, nextCardWasHidden); } else { UndoScript.undoScript.LogMove("draw", gameObject, isAction); } } destination.GetComponent <WastepileScript>().AddCard(gameObject, showHolo: showHolo); } else if (destination.CompareTag("Deck")) { if (doLog) { UndoScript.undoScript.LogMove("deckreset", gameObject, isAction); } destination.GetComponent <DeckScript>().AddCard(gameObject); } else if (destination.CompareTag("MatchedPile")) { if (doLog) { UndoScript.undoScript.LogMove("match", gameObject, isAction, nextCardWasHidden); } destination.GetComponent <MatchedPileScript>().AddCard(gameObject); } else if (destination.CompareTag("LoadPile")) { if (doLog) { UndoScript.undoScript.LogMove("match", gameObject, isAction, nextCardWasHidden); } destination.GetComponent <LoadPileScript>().AddCard(gameObject); } container = destination; }