void Update() { switch (_state) { case State.WaitingForMove: if (playerA.hasSelectedCard() && playerB.hasSelectedCard()) { _state = State.Ready; delay = DELAY_TILL_REVEAL; playerACardIndex = playerA.getSelectedCard(playerB); playerBCardIndex = playerB.getSelectedCard(playerA); string debugString = "Server: " + string.Format("Player {0} picked {1} (index {2}). ", playerA.AgentName, playerA.CardAt(playerACardIndex), playerACardIndex) + string.Format("Player {0} picked {1} (index {2}). ", playerB.AgentName, playerB.CardAt(playerBCardIndex), playerBCardIndex); Debug.Log(debugString); } break; case State.Ready: delay -= Time.deltaTime; if (delay <= 0.0f) { _state = State.TurnComplete; } break; case State.TurnComplete: PlayGameAndSendResults(playerACardIndex, playerBCardIndex); MatchManager.EndMatch(this); Destroy(this.gameObject); break; } }
public virtual void CreateHand() { ClearHand(); for (int i = 0; i < player.CardCount(); ++i) { CardVisual c = Instantiate <CardVisual>(cardPrefab); c.transform.SetParent(this.transform, false); c.transform.SetSiblingIndex(i); c.card = player.CardAt(i); c.isHidden = isHidden; cardVisuals.Add(c); } lastHandCount = cardVisuals.Count; }