public void StartPlaying(GhostReplayData _data) { replayData = _data; if (replayData == null) { return; } if (replayData.GetRecordedAtSeed() != GlobalGameData.currentInstance.m_playerData_eventActive.GetSeed() || replayData.GetRecordedAtGamemode() != GlobalGameData.currentInstance.m_playerData_eventActive.GetGamemode()) { return; } ghostNameText.text = replayData.GetGhostName(); CSManager.ChangeBaseSkin(replayData.GetGhostSkinID()); playing = true; StartCoroutine("PlayGhost"); }
public void SetPlayerGhostPB(GhostReplayData ghost) { if (ghost.GetRecordedAtSeed() != m_playerData_eventActive.GetSeed() || playerGhostPB == null) { print("[REPLAY] No comparable ghost found, setting as PB"); playerGhostPB = ghost; } else { if (ghost.GetScoreRecordedIsTime()) { if (ghost.GetScoreRecorded() < playerGhostPB.GetScoreRecorded()) { playerGhostPB = ghost; print("[REPLAY] New ghost PB"); } else { print("[REPLAY] Discarding ghost."); } } else { if (ghost.GetScoreRecorded() > playerGhostPB.GetScoreRecorded()) { playerGhostPB = ghost; print("[REPLAY] New ghost PB"); } else { print("[REPLAY] Discarding ghost."); } } } //OutputLastGhostToFile (); }
void OutputLastGhostToFile() { BinaryFormatter binForm = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/Ghost_" + m_playerData_playerName + "_" + playerGhostPB.GetRecordedAtSeed().ToString() + "_" + System.Environment.TickCount + ".Ghost"); binForm.Serialize(file, playerGhostPB); file.Close(); }