// The Draw function will pull a single card from the drawPile and return it public CardLostCities Draw() { CardLostCities cd = drawPile[0]; // Pull the 0th CardLostCities //if (drawPile.Count == 0) //{ // If the drawPile is now empty // We need to shuffle the discards into the drawPile //int ndx; //while (discardPile.Count > 0) //{ // // Pull a random card from the discard pile // ndx = Random.Range(0, discardPile.Count); // drawPile.Add(discardPile[ndx]); // discardPile.RemoveAt(ndx); //} //ArrangeDrawPile(); // Show the cards moving to the drawPile //float t = Time.time; //foreach (CardLostCities tCB in drawPile) //{ // tCB.transform.localPosition = layout.discardPile.pos; // tCB.callbackPlayer = null; // tCB.MoveTo(layout.drawPile.pos); // tCB.timeStart = t; // t += 0.02f; // tCB.state = CBState.toDrawpile; // tCB.eventualSortLayer = "0"; //} //} drawPile.RemoveAt(0); // Then remove it from List<> drawPile return(cd); // And return it }
public List <CardLostCities> hand; // The cards in this player's hand // Add a card to the hand public CardLostCities AddCard(CardLostCities eCB) { if (hand == null) { hand = new List <CardLostCities>(); } // Add the card to the hand hand.Add(eCB); //Sort the cards by rank using LINQ if this is a human if (type == PlayerType.human) { CardLostCities[] cards = hand.ToArray(); // This is the LINQ call cards = cards.OrderBy(cd => cd.rank).ToArray(); hand = new List <CardLostCities>(cards); // Note: LINQ operations can be a bit slow (like it could take a // couple of milliseconds), but since we're only doing it once // every round, it isn't a problem. } eCB.SetSortingLayerName("10"); // Sorts the moving card to the top eCB.eventualSortLayer = handSlotDef.layerName; FanHand(); return(eCB); }
public List <CardLostCities> WhichPlayerDiscard(CardLostCities tCB) { Debug.Log(tCB.suit); { if (tCB.suit.Equals("R")) { return(redPlayer1); } else if (tCB.suit.Equals("G")) { return(greenPlayer1); } else if (tCB.suit.Equals("W")) { return(whitePlayer1); } else if (tCB.suit.Equals("B")) { return(bluePlayer1); } else { return(yellowPlayer1); } } }
/* * public bool CheckGameOver() * { * // See if we need to reshuffle the discard pile into the draw pile * if (drawPile.Count == 0) * { * List<Card> cards = new List<Card>(); * //foreach (CardLostCities cb in discardPile) * //{ * // cards.Add(cb); * //} * //discardPile.Clear(); * Deck.Shuffle(ref cards); * drawPile = UpgradeCardsList(cards); * ArrangeDrawPile(); * } * * // Check to see if the current player has won * if (CURRENT_PLAYER.hand.Count == 0) * { * // The player that just played has won! * phase = TurnPhase.gameOver; * Invoke("RestartGame", 1); * return (true); * } * return (false); * } * * * public void RestartGame() * { * CURRENT_PLAYER = null; * SceneManager.LoadScene("__LostCities_Scene_0"); * } */ // ValidPlay verifies that the card chosen can be played on the discard pile public bool ValidPlay(CardLostCities cb) { // It's a valid play if the suit is the same // Check is its a higher rank //if (cb.suit == targetCard.suit) //{ // if (cb.rank > targetCard.rank) return (true); //} if (WhichPlayerDiscard(cb).Count == 0) { return(true); } else if (cb.rank > WhichPlayerDiscard(cb)[WhichPlayerDiscard(cb).Count - 1].rank) { return(true); } else if (cb.rank == 1 && WhichPlayerDiscard(cb)[WhichPlayerDiscard(cb).Count - 1].rank == 1) { return(true); } // Otherwise, return false return(false); }
public CardLostCities YellowDraw() { int i = yellowDiscardPile.Count - 1; CardLostCities cd = yellowDiscardPile[i]; yellowDiscardPile.RemoveAt(i); return(cd); }
public CardLostCities BlueDraw() { int i = blueDiscardPile.Count - 1; CardLostCities cd = blueDiscardPile[i]; blueDiscardPile.RemoveAt(i); return(cd); }
public CardLostCities WhiteDraw() { int i = whiteDiscardPile.Count - 1; CardLostCities cd = whiteDiscardPile[i]; whiteDiscardPile.RemoveAt(i); return(cd); }
public CardLostCities GreenDraw() { int i = greenDiscardPile.Count - 1; CardLostCities cd = greenDiscardPile[i]; greenDiscardPile.RemoveAt(i); return(cd); }
public CardLostCities RedDraw() { Debug.Log(redDiscardPile.Count - 1); int i = redDiscardPile.Count - 1; CardLostCities cd = redDiscardPile[i]; redDiscardPile.RemoveAt(i); return(cd); }
// Remove a card from the hand public CardLostCities RemoveCard(CardLostCities cb) { // If hand is null or doesn't contain cb, return null if (hand == null || !hand.Contains(cb)) { return(null); } hand.Remove(cb); FanHand(); return(cb); }
public int DifferencePlay(CardLostCities cb) { if (WhichAIDiscard(cb).Count == 0) { return(cb.rank); } else if (cb.rank > WhichAIDiscard(cb)[WhichAIDiscard(cb).Count - 1].rank) { return(cb.rank - WhichAIDiscard(cb)[WhichAIDiscard(cb).Count - 1].rank); } }
public List <CardLostCities> WhichPlayerDiscard(CardLostCities tCB) { Debug.Log(tCB.suit); if (CURRENT_PLAYER.type == PlayerType.human) { if (tCB.suit.Equals("R")) { return(redPlayer1); } else if (tCB.suit.Equals("G")) { return(greenPlayer1); } else if (tCB.suit.Equals("W")) { return(whitePlayer1); } else if (tCB.suit.Equals("B")) { return(bluePlayer1); } else { return(yellowPlayer1); } } //else { if (tCB.suit.Equals("R")) { return(redPlayer2); } else if (tCB.suit.Equals("G")) { return(greenPlayer2); } else if (tCB.suit.Equals("W")) { return(whitePlayer2); } else if (tCB.suit.Equals("B")) { return(bluePlayer2); } else { return(yellowPlayer2); } } }
public CardLostCities MoveToAIDiscard(CardLostCities tCB) { WhichAIDiscard(tCB).Add(tCB); if (tCB.suit.Equals("R")) { tCB.SetSortingLayerName(layout.redPlayer2.layerName); tCB.SetSortOrder(redPlayer2.Count * 4); tCB.transform.localPosition = layout.redPlayer2.pos + Vector3.back / 2; tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); ArrangePlayer2Pile(); } if (tCB.suit.Equals("G")) { tCB.SetSortingLayerName(layout.greenPlayer2.layerName); tCB.SetSortOrder(greenPlayer2.Count * 4); tCB.transform.localPosition = layout.greenPlayer2.pos + Vector3.back / 2; tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); ArrangePlayer2Pile(); } if (tCB.suit.Equals("W")) { tCB.SetSortingLayerName(layout.whitePlayer2.layerName); tCB.SetSortOrder(whitePlayer2.Count * 4); tCB.transform.localPosition = layout.whitePlayer2.pos + Vector3.back / 2; tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); ArrangePlayer2Pile(); } if (tCB.suit.Equals("B")) { tCB.SetSortingLayerName(layout.bluePlayer2.layerName); tCB.SetSortOrder(bluePlayer2.Count * 4); tCB.transform.localPosition = layout.bluePlayer2.pos + Vector3.back / 2; tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); ArrangePlayer2Pile(); } if (tCB.suit.Equals("Y")) { tCB.SetSortingLayerName(layout.yellowPlayer2.layerName); tCB.SetSortOrder(yellowPlayer2.Count * 4); tCB.transform.localPosition = layout.yellowPlayer2.pos + Vector3.back / 2; tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); ArrangePlayer2Pile(); } tCB.state = CBState.player2; players[1].RemoveCard(tCB); return(tCB); }
public void CardClicked(CardLostCities tCB) { //if (CURRENT_PLAYER.type != PlayerType.human) return; //if (phase == TurnPhase.waiting) return; ChangeTarget(tCB); switch (tCB.state) { case CBState.drawpile: if (players[0].hand.Count < 8) { players[0].AddCard(Draw()); } break; case CBState.hand: popUp = true; break; case CBState.discard: if (players[0].hand.Count < 8) { if (targetKeepCard.suit.Equals("R")) { players[0].AddCard(RedDraw()); } else if (targetKeepCard.suit.Equals("G")) { players[0].AddCard(GreenDraw()); } else if (targetKeepCard.suit.Equals("W")) { players[0].AddCard(WhiteDraw()); } else if (targetKeepCard.suit.Equals("B")) { players[0].AddCard(BlueDraw()); } else if (targetKeepCard.suit.Equals("Y")) { players[0].AddCard(YellowDraw()); } } break; } }
// This makes a new card the target public CardLostCities MoveToTarget(CardLostCities tCB) { tCB.timeStart = 0; tCB.state = CBState.toTarget; tCB.faceUp = true; tCB.SetSortingLayerName("10"); tCB.eventualSortLayer = layout.target.layerName; if (targetCard != null) { MoveToDiscard(targetCard); } targetCard = tCB; return(tCB); }
public List <CardLostCities> WhichDiscard(CardLostCities tCB) { Debug.Log(tCB.suit); if (tCB.suit.Equals("R")) { return(redDiscardPile); } else if (tCB.suit.Equals("G")) { return(greenDiscardPile); } else if (tCB.suit.Equals("W")) { return(whiteDiscardPile); } else if (tCB.suit.Equals("B")) { return(blueDiscardPile); } else { return(yellowDiscardPile); } }
public void CBCallback(CardLostCities tCB) { Utils.tr("Player.CBCallback()", tCB.name, "Player " + playerNum); // The card is done moving, so pass the turn LostCities.S.PassTurn(); }
// The TakeTurn() function enables the AI of the computer Players public void TakeTurn() { Utils.tr("Player.TakeTurn"); // Don't need to do anything if this is the human player. //if (type == PlayerType.human) return; //LostCities.S.phase = TurnPhase.waiting; CardLostCities cb; // If this is an AI player, need to make a choice about what to play // Find valid plays List <CardLostCities> validCards = new List <CardLostCities>(); List <CardLostCities> discardCards = new List <CardLostCities>(); List <CardLostCities> cardtoPlay = new List <CardLostCities>(); foreach (CardLostCities tCB in hand) { if (tCB.rank != 1) { if (LostCities.S.drawPile.Capacity > 6) { if (tCB.rank > LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank) { validCards.Add(tCB); if (tCB.rank == LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank + 1) { tCB.setWeight(tCB.getWeight() + 2); if (LostCities.S.WhichAIDiscard(tCB)[0].rank == 1) { tCB.setWeight(tCB.getWeight() + 1); } } else { if (tCB.rank < LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank + 6) { tCB.setWeight(tCB.getWeight() + 1); } else { tCB.setWeight(tCB.getWeight() - 3); } } } else { discardCards.Add(tCB); } } else { if (tCB.rank > LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank) { if (tCB.rank == LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank + 1) { tCB.setWeight(tCB.getWeight() + 1); } else { if (tCB.rank > LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank + 6) { tCB.setWeight(tCB.getWeight() + 1); if (LostCities.S.WhichAIDiscard(tCB)[0].rank == 1) { tCB.setWeight(tCB.getWeight() + 1); } } } } } foreach (CardLostCities tCR in hand) { if (tCB.suit.Equals(tCR.suit)) { if (tCB.rank < tCR.rank) { if (tCB.getOtherCard()) { tCB.setWeight(tCB.getWeight() + 1); tCB.setOtherCard(true); } } else if (tCB.rank > tCR.rank) { if (!tCB.getOtherCard()) { tCB.setWeight(tCB.getWeight() - 2); tCB.setOtherCard(true); } } else if (tCB.rank == tCR.rank) { if (!tCB.getOtherCard() && !tCR.getOtherCard()) { tCB.setWeight(tCB.getWeight() - 2); tCB.setOtherCard(true); tCR.setWeight(tCB.getWeight() + 1); tCR.setOtherCard(true); } else if (!tCB.getOtherCard() && tCR.getOtherCard()) { tCB.setWeight(tCB.getWeight() + 1); tCB.setOtherCard(true); } else if (tCB.getOtherCard() && !tCR.getOtherCard()) { tCR.setWeight(tCB.getWeight() + 1); tCR.setOtherCard(true); } } } } } else { int sameSuit = 0; foreach (CardLostCities tCK in hand) { if (tCK.suit.Equals(tCB.suit)) { sameSuit++; } } if (tCB.rank < LostCities.S.WhichAIDiscard(tCB)[LostCities.S.WhichAIDiscard(tCB).Count - 1].rank) { discardCards.Add(tCB); } else if (sameSuit >= 1) { tCB.setWeight(3); validCards.Add(tCB); } else if (sameSuit == 1) { tCB.setWeight(2); validCards.Add(tCB); } else if (sameSuit == 0) { tCB.setWeight(1); validCards.Add(tCB); } } } // If there are no valid cards if (validCards.Count == 0) { CardLostCities tB = discardCards[Random.Range(0, discardCards.Count)]; LostCities.S.MoveToDiscard(tB); return; } else { int highestWeight = 0; foreach (CardLostCities tCM in validCards) { if (tCM.getWeight() > cardtoPlay[0].getWeight()) { highestWeight = tCM.getWeight(); validCards.Add(cardtoPlay[0]); cardtoPlay.Add(tCM); } } if (highestWeight >= 2) { cb = cardtoPlay[0]; LostCities.S.MoveToAIDiscard(cb); } else { CardLostCities tB = discardCards[Random.Range(0, discardCards.Count)]; LostCities.S.MoveToDiscard(tB); return; } } // So, there is a card or more to play, so pick one //cb = validCards[Random.Range(0, validCards.Count)]; //RemoveCard(cb); //LostCities.S.MoveToTarget(cb); //cb.callbackPlayer = this; foreach (CardLostCities tCB in hand) { tCB.setWeight(0); tCB.setOtherCard(false); } }
public void CardClicked(CardLostCities tCB) { //if (CURRENT_PLAYER.type != PlayerType.human) return; //if (phase == TurnPhase.waiting) return; ChangeTarget(tCB); switch (tCB.state) { case CBState.drawpile: // Draw the top card, not necessarily the one clicked. //CardLostCities cb = CURRENT_PLAYER.AddCard(Draw()); //cb.callbackPlayer = CURRENT_PLAYER; //Utils.tr("LostCities:CardClicked()", "Draw", cb.name); //phase = TurnPhase.waiting; if (players[0].hand.Count < 8) { players[0].AddCard(Draw()); ArrangeDrawPile(); playerTurn = !playerTurn; played = false; } break; case CBState.hand: // Check to see whether the card is valid if (!played) { popUp = true; } //if (ValidPlay(tCB)) //{ // MoveToPlayerDiscard(tCB); // CURRENT_PLAYER.RemoveCard(tCB); // MoveToTarget(tCB); // tCB.callbackPlayer = CURRENT_PLAYER; // Utils.tr("LostCities:CardClicked()", "Play", tCB.name, targetCard.name + " is target"); // phase = TurnPhase.waiting; //} { // Just ignore it but report what the player tried // Utils.tr("LostCities:CardClicked()", "Attempted to Play", tCB.name, targetCard.name + " is target"); } break; case CBState.redDiscard: if (players[0].hand.Count < 8) { players[0].AddCard(RedDraw()); } break; case CBState.greenDiscard: if (players[0].hand.Count < 8) { players[0].AddCard(GreenDraw()); } break; case CBState.whiteDiscard: if (players[0].hand.Count < 8) { players[0].AddCard(WhiteDraw()); } break; case CBState.blueDiscard: if (players[0].hand.Count < 8) { players[0].AddCard(BlueDraw()); } break; case CBState.yellowDiscard: if (players[0].hand.Count < 8) { players[0].AddCard(YellowDraw()); } break; } }
public CardLostCities MoveToAIDiscard(CardLostCities tCB) { WhichAIDiscard(tCB).Add(tCB); Vector3 pos; tCB.timeStart = 0; if (tCB.suit.Equals("R")) { tCB.SetSortingLayerName(layout.redPlayer2.layerName); tCB.SetSortOrder(redPlayer2.Count * 4); pos = layout.redPlayer2.pos; tCB.MoveTo(pos); tCB.state = CBState.toRedPlayer2; ArrangePlayer2Pile(); } if (tCB.suit.Equals("G")) { tCB.SetSortingLayerName(layout.greenPlayer2.layerName); tCB.SetSortOrder(greenPlayer2.Count * 4); pos = layout.greenPlayer2.pos; tCB.MoveTo(pos); tCB.state = CBState.toGreenPlayer2; ArrangePlayer2Pile(); } if (tCB.suit.Equals("W")) { tCB.SetSortingLayerName(layout.whitePlayer2.layerName); tCB.SetSortOrder(whitePlayer2.Count * 4); pos = layout.whitePlayer2.pos; tCB.MoveTo(pos); tCB.state = CBState.toWhitePlayer2; ArrangePlayer2Pile(); } if (tCB.suit.Equals("B")) { tCB.SetSortingLayerName(layout.bluePlayer2.layerName); tCB.SetSortOrder(bluePlayer2.Count * 4); pos = layout.bluePlayer2.pos; tCB.MoveTo(pos); tCB.state = CBState.toBluePlayer2;; ArrangePlayer2Pile(); } if (tCB.suit.Equals("Y")) { tCB.SetSortingLayerName(layout.yellowPlayer2.layerName); tCB.SetSortOrder(yellowPlayer2.Count * 4); pos = layout.yellowPlayer2.pos; tCB.MoveTo(pos); tCB.state = CBState.toYellowPlayer2; ArrangePlayer2Pile(); } players[1].RemoveCard(tCB); return(tCB); }
public CardLostCities MoveToPlayerDiscard(CardLostCities tCB) { WhichPlayerDiscard(tCB).Add(tCB); Vector3 pos; tCB.timeStart = 0; if (tCB.suit.Equals("R")) { tCB.SetSortingLayerName(layout.redPlayer1.layerName); tCB.SetSortOrder(redPlayer1.Count * 4); //tCB.transform.localPosition = layout.redPlayer1.pos + Vector3.back / 2; //tCB.transform.localRotation = Quaternion.Euler(Vector3.zero); pos = layout.redPlayer1.pos; tCB.MoveTo(pos); tCB.state = CBState.toRedPlayer1; ArrangePlayerPile(); } if (tCB.suit.Equals("G")) { tCB.SetSortingLayerName(layout.greenPlayer1.layerName); tCB.SetSortOrder(greenPlayer1.Count * 4); pos = layout.greenPlayer1.pos; tCB.MoveTo(pos); tCB.state = CBState.toGreenPlayer1; ArrangePlayerPile(); } if (tCB.suit.Equals("W")) { tCB.SetSortingLayerName(layout.whitePlayer1.layerName); tCB.SetSortOrder(whitePlayer1.Count * 4); pos = layout.whitePlayer1.pos; tCB.MoveTo(pos); tCB.state = CBState.toWhitePlayer1; ArrangePlayerPile(); } if (tCB.suit.Equals("B")) { tCB.SetSortingLayerName(layout.bluePlayer1.layerName); tCB.SetSortOrder(bluePlayer1.Count * 4); pos = layout.bluePlayer1.pos; tCB.MoveTo(pos); tCB.state = CBState.toBluePlayer1; ArrangePlayerPile(); } if (tCB.suit.Equals("Y")) { tCB.SetSortingLayerName(layout.yellowPlayer1.layerName); tCB.SetSortOrder(yellowPlayer1.Count * 4); pos = layout.yellowPlayer1.pos; tCB.MoveTo(pos); tCB.state = CBState.toYellowPlayer1; ArrangePlayerPile(); } players[0].RemoveCard(tCB); return(tCB); }
public void ChangeTarget(CardLostCities tCB) { targetKeepCard = tCB; Debug.Log(tCB.state); }
// This callback is used by the last card to be dealt at the beginning public void CBCallback(CardLostCities cb) { // You sometimes want to have reporting of method calls like this Utils.tr("LostCities:CBCallback()", cb.name); StartGame(); // Start the Game }
private void Update() { CardLostCities tCB = LostCities.S.CurrentCard(); switch (state) { case CBState.toHand: case CBState.toTarget: case CBState.toDrawpile: case CBState.toRedDiscard: case CBState.toGreenDiscard: case CBState.toWhiteDiscard: case CBState.toBlueDiscard: case CBState.toYellowDiscard: case CBState.toRedPlayer1: case CBState.toRedPlayer2: case CBState.toGreenPlayer1: case CBState.toGreenPlayer2: case CBState.toWhitePlayer1: case CBState.toWhitePlayer2: case CBState.toBluePlayer1: case CBState.toBluePlayer2: case CBState.toYellowPlayer1: case CBState.toYellowPlayer2: case CBState.to: float u = (Time.time - timeStart) / timeDuration; float uC = Easing.Ease(u, MOVE_EASING); if (u < 0) { transform.localPosition = bezierPts[0]; transform.rotation = bezierRots[0]; return; } else if (u >= 1) { uC = 1; // Move from the to... state to the proper next state if (state == CBState.toHand) { state = CBState.hand; } if (state == CBState.toTarget) { state = CBState.target; } if (state == CBState.toRedDiscard) { state = CBState.redDiscard; } if (state == CBState.toGreenDiscard) { state = CBState.greenDiscard; } if (state == CBState.toWhiteDiscard) { state = CBState.whiteDiscard; } if (state == CBState.toBlueDiscard) { state = CBState.blueDiscard; } if (state == CBState.toYellowDiscard) { state = CBState.yellowDiscard; } if (state == CBState.toRedPlayer1) { state = CBState.redPlayer1; } if (state == CBState.toRedPlayer2) { state = CBState.redPlayer2; } if (state == CBState.toGreenPlayer1) { state = CBState.greenPlayer1; } if (state == CBState.toGreenPlayer2) { state = CBState.greenPlayer2; } if (state == CBState.toWhitePlayer1) { state = CBState.whitePlayer1; } if (state == CBState.toWhitePlayer2) { state = CBState.whitePlayer2; } if (state == CBState.toBluePlayer1) { state = CBState.bluePlayer1; } if (state == CBState.toBluePlayer2) { state = CBState.bluePlayer2; } if (state == CBState.toYellowPlayer1) { state = CBState.yellowPlayer1; } if (state == CBState.toYellowPlayer2) { state = CBState.yellowPlayer2; } if (state == CBState.toDrawpile) { state = CBState.drawpile; } if (state == CBState.to) { state = CBState.idle; } // Move to the final position transform.localPosition = bezierPts[bezierPts.Count - 1]; transform.rotation = bezierRots[bezierPts.Count - 1]; // Reset timeStart to 0 so it gets overwritten next time if (state == CBState.redDiscard) { LostCities.S.ArrangeDiscard(tCB); } if (state == CBState.greenDiscard) { LostCities.S.ArrangeDiscard(tCB); } if (state == CBState.whiteDiscard) { LostCities.S.ArrangeDiscard(tCB); } if (state == CBState.blueDiscard) { LostCities.S.ArrangeDiscard(tCB); } if (state == CBState.yellowDiscard) { LostCities.S.ArrangeDiscard(tCB); } //Invoke("LostCities.S.ArrangePlayerPile", 2); //Invoke("LostCities.S.ArrangePlayer2Pile", 2); timeStart = 0; //this code not used if (reportFinishTo != null) { reportFinishTo.SendMessage("CBCallback", this); reportFinishTo = null; } else if (callbackPlayer != null) { // If there's a callback Player // Call CBCallback directly on the Player callbackPlayer.CBCallback(this); callbackPlayer = null; } else { // If there is nothing to callback // Just let it stay still. } } else { // Normal interpolation behavior (0 <= u < 1) Vector3 pos = Utils.Bezier(uC, bezierPts); transform.localPosition = pos; Quaternion rotQ = Utils.Bezier(uC, bezierRots); transform.rotation = rotQ; if (u > 0.5f) { SpriteRenderer sRend = spriteRenderers[0]; if (sRend.sortingOrder != eventualSortOrder) { // Jump to the proper sort order SetSortOrder(eventualSortOrder); } if (sRend.sortingLayerName != eventualSortLayer) { // Jump to the proper sort layer SetSortingLayerName(eventualSortLayer); } } } break; } }