private void InSimulate() { float tempTime; if (isRewindingForSimulation) { tempTime = time - Time.deltaTime * rewindSpeed; if (tempTime < turnStartTime) { time = turnStartTime; isRewindingForSimulation = false; TimeDisplay.SetState(TimeDisplayState.NONE); } else { time = tempTime; } } else { tempTime = time + Time.deltaTime * playerSpeed; if (tempTime > turnStartTime + turnLength) { StartNewTurn(); } else { time = tempTime; } } }
private void InCardSelect() { float turnBeginTime = (turnNumber - 1) * turnLength; float turnEndTime = turnNumber * turnLength; bool isAtEnd = time == turnEndTime; Player player = ReInput.players.GetPlayer(0); float rewind = player.GetAxis("Rewind"); float fastf = player.GetAxis("Fastforward"); time += Mathf.Pow(fastf, 4) * Time.deltaTime * 5; time -= Mathf.Pow(rewind, 4) * Time.deltaTime * 5; time = Mathf.Clamp(time, turnBeginTime, turnEndTime); if (time == turnEndTime && !isAtEnd) { TimeDisplay.SetState(TimeDisplayState.END); } else if (time != turnEndTime && isAtEnd) { TimeDisplay.SetState(TimeDisplayState.NONE); } if (player.GetButton("Start") && isAtEnd) { PlayTurn(); } }
void PlayTurn() { ChangeState(GameState.SIMULATE_PLAY); //time = turnStartTime; TimeDisplay.SetState(TimeDisplayState.REWIND); isRewindingForSimulation = true; }
void IsDying() { currentDeathTime += Time.deltaTime; time += Time.deltaTime; if (currentDeathTime > deathPlayTime) { ChangeState(GameState.IS_RESURECTING); TimeDisplay.SetState(TimeDisplayState.REWIND); } }
void IsResurecting() { Player player = ReInput.players.GetPlayer(0); float rewind = player.GetAxis("Rewind"); if (rewind != 0) { TimeDisplay.SetState(TimeDisplayState.NONE); } time -= Mathf.Pow(rewind, 4) * Time.deltaTime * 5; if (time < deathStartTime - 0.2f) { ChangeState(GameState.CARD_SELECT); } }