void MoveToDiscard(CardProspector cd) { cd.state = CardState.discard; discardPile.Add(cd); cd.transform.parent = layoutAnchor; cd.transform.localPosition = new Vector3( layout.multipler.x * layout.discardPile.x, layout.multipler.y * layout.discardPile.y, -layout.discardPile.layerID + .5f); cd.faceUp = true; cd.SetSortingLayerName(layout.discardPile.layerName); cd.SetSortingOrder(-100 + discardPile.Count); }
void MoveToTarget(CardProspector cd) { if (target != null) { MoveToDiscard(target); } target = cd; cd.state = CardState.target; cd.transform.parent = layoutAnchor; cd.transform.localPosition = new Vector3( layout.multipler.x * layout.discardPile.x, layout.multipler.y * layout.discardPile.y, -layout.discardPile.layerID); cd.faceUp = true; cd.SetSortingLayerName(layout.discardPile.layerName); cd.SetSortingOrder(0); }
// Move the top card of the DrawPile to the target void MoveToTarget(CardProspector cd) { // Set the card state to target cd.state = CardState.target; // Set the parent and localpotion to the target position cd.transform.parent = layoutAnchor; cd.transform.localPosition = new Vector3( layout.multiplier.x * layout.discardPile.x, layout.multiplier.y * layout.discardPile.y, -layout.discardPile.layerId); // Set the faceUp cd.faceUp = true; // Set it to target target = cd; // Place it on the target layer and set the order cd.SetSortingLayerName(layout.discardPile.layerName); cd.SetSortingOrder(0); }
// Moves the current target to the discardPile void MoveToDiscard(CardProspector cd) { // Set the card state to discard cd.state = CardState.discard; // Set the parent and localposition to the discardpile cd.transform.parent = layoutAnchor; float x = layout.multiplier.x * layout.discardPile.x; float y = layout.multiplier.y * layout.discardPile.y; cd.transform.localPosition = new Vector3(x, y, -layout.discardPile.layerId + 0.5f); // Set the faceUp cd.faceUp = true; // Add it to the list of discardPile discardPile.Add(cd); // Place it on top of the pile for depth sorting cd.SetSortingLayerName(layout.discardPile.layerName); cd.SetSortingOrder(-100 + discardPile.Count); }
// Arrange all the cards of the drawPile to show how many are left void UpdateDrawPile() { // go through all the left cards in the drawPile for (int i = 0; i < drawPile.Count; i++) { // Set the position CardProspector cd = drawPile[i]; cd.transform.parent = layoutAnchor; cd.transform.localPosition = new Vector3( layout.multiplier.x * (layout.drawPile.x + i * layout.drawPile.stagger.x), layout.multiplier.y * (layout.drawPile.y + i * layout.drawPile.stagger.y), -layout.drawPile.layerId + i * 0.1f); // Set the face down cd.faceUp = false; // Set the state as drawpile cd.state = CardState.drawpile; // Sorting the order and layers cd.SetSortingLayerName(layout.drawPile.layerName); cd.SetSortingOrder(-10 * i); } }
void MoveToTarget(CardProspector cd) { if (target != null) { MoveToDiscard(target); } target = cd; cd.state = CardState.target; cd.transform.parent= layoutAnchor; cd.transform.localPosition = new Vector3 ( layout.multipler.x * layout.discardPile.x, layout.multipler.y * layout.discardPile.y, -layout.discardPile.layerID); cd.faceUp = true; cd.SetSortingLayerName (layout.discardPile.layerName); cd.SetSortingOrder (0); }
void MoveToDiscard(CardProspector cd) { cd.state = CardState.discard; discardPile.Add (cd); cd.transform.parent = layoutAnchor; cd.transform.localPosition = new Vector3 ( layout.multipler.x*layout.discardPile.x, layout.multipler.y*layout.discardPile.y, -layout.discardPile.layerID + .5f); cd.faceUp = true; cd.SetSortingLayerName (layout.discardPile.layerName); cd.SetSortingOrder (-100 + discardPile.Count); }