private IEnumerator FlipCardRoutine(ECardState state, float animTime) { button.enabled = false; float halfEndRotY = animBase.rotation.eulerAngles.y + 90; float fullEndRotY = animBase.rotation.eulerAngles.y + 180; float halfTotalTime = animTime / 2; float fullTotalTime = animTime; float timeStep = fullTotalTime / 10; float rotX = animBase.rotation.eulerAngles.x; float rotZ = animBase.rotation.eulerAngles.z; var halfRot = Quaternion.Euler(rotX, halfEndRotY, rotZ); var fullRot = Quaternion.Euler(rotX, fullEndRotY, rotZ); var startRot = animBase.rotation; var waitForTimeStep = new WaitForSeconds(timeStep); float t = 0; while (t / halfTotalTime <= 1.0f) { t += timeStep; animBase.rotation = Quaternion.Lerp(startRot, halfRot, t / halfTotalTime); yield return(waitForTimeStep); } textField.gameObject.SetActive((state == ECardState.FaceUp) ? true : false); image.color = (state == ECardState.FaceUp) ? faceUpTint : _defaultTint; while (t / fullTotalTime <= 1.0f) { t += timeStep; animBase.rotation = Quaternion.Lerp(startRot, fullRot, t / fullTotalTime); yield return(waitForTimeStep); } button.enabled = true; }
public void SetState(ECardState state) { if (state == ECardState.Eliminated) { VanishCard(); } else { FlipCard(state); } }
void SetECardState() { if (TurnManager.Inst.isLoading) { eCardState = ECardState.Nothing; } else if (!TurnManager.Inst.myTurn || myPutCount == 1 || EntityManager.Inst.IsFullMyEntities) { eCardState = ECardState.CanMouseOver; } else if (TurnManager.Inst.myTurn && myPutCount == 0) { eCardState = ECardState.CanMouseDrag; } }
private void CardClickedHandler(int index) { ECardState state = gridModel.cards[index].state; if (state == ECardState.Eliminated) { return; } var newState = (state == ECardState.FaceDown) ? ECardState.FaceUp : ECardState.FaceDown; gridModel.cards[index].state = newState; gridView.SetCardState(index, newState); ScheduleGameTick(); }
private IEnumerator GameTick(float waitTime) { _onGameTickScheduled.Invoke(); yield return(new WaitForSeconds(waitTime)); List <int> updatedCards = GameGridModel.UpdateGameGrid(gridModel); for (int i = 0; i < updatedCards.Count; i++) { ECardState newState = gridModel.cards[updatedCards[i]].state; gridView.SetCardState(updatedCards[i], newState); if (newState == ECardState.Eliminated) { _score += setting.eliminationScorePoints; } } _onGameTickPerformed.Invoke(); _tickRoutine = null; }
public void SetCardState(int index, ECardState state) { var card = _cards[index]; card.SetState(state); }
private void FlipCard(ECardState state, float animTime = 0.1f) { StartCoroutine(FlipCardRoutine(state, animTime)); }
public Card(Card original) { state = original.state; content = original.content; }
public Card(ECardState state, string content) { this.state = state; this.content = content; }