public void UpdateView(KarutaPlayer player) { var newScoreText = $"{player.Score}"; if (scoreText.text != newScoreText) { StartScoreAnimation(); } UIUtility.TrySetText(scoreText, newScoreText); if (!penaltyObject.activeSelf && player.IsPenalty) { StartPenaltyAnimation(); } UIUtility.TrySetActive(penaltyObject, player.IsPenalty); UIUtility.TrySetActive(winObject, player.IsWin); }
private void OnTouchedSimpleCard(KarutaPlayer karutaPlayer, StandardID.SimpleCardType simpleCardType) { if (!isWithinGame || karutaPlayer.IsPenalty || !ToioSimpleCardUtility.IsAlphabet(simpleCardType)) { return; } if (!currentTargetSimpleCardType.HasValue || currentTargetSimpleCardType.Value != simpleCardType) { karutaPlayer.IsPenalty = true; UpdateView(karutaPlayers); if (karutaPlayers.TrueForAll(_player => _player.IsPenalty)) { _ = ResetPenalties(1000); } return; } karutaPlayer.IncrementScore(); UpdateView(karutaPlayers); isWithinGame = false; currentTargetSimpleCardType = null; }