private void CreateGhostPlayer()
    {
        Debug.Log("[GhostController] CreateGhostPlayer");

        if (RS_GamePlayController.Mode == RS_GameMode.Multiplayer)
        {
                        #if !UNITY_EDITOR
            LoadedGhostData = RS_GamePlayController.Instance.Multiplayer.CompetitorReplay;
                        #endif
        }
        else
        {
            if (RS_PlayerData.Instance.HasGhostData("Desert"))
            {
                LoadedGhostData = GhostReplayData.GetGhostDataOnTrack("Desert");
            }
        }

        if (LoadedGhostData != null)
        {
            Debug.Log(LoadedGhostData.CarId);
            Debug.Log(LoadedGhostData.CarLevel);
            Debug.Log(LoadedGhostData.RawData.ToString() + " Count:" + LoadedGhostData.RawData.Count);

            foreach (GhostDataBundle action in LoadedGhostData.RawData)
            {
                StartCoroutine(GhostRacerAction(action.Event, action.Time));
            }

            RS_CarFactory.CarLoadedAction += HandleActionGhostCarLoaded;
            RS_CarFactory.CreateCar(LoadedGhostData.CarId, RS_CarCreationMode.Garage);
        }
    }
    public MultiplayerReplayData(string pID, GhostReplayData ghostData) : base()
    {
        _ParticipantID = pID;

        _CarId      = ghostData.CarId;
        _CarLevel   = ghostData.CarLevel;
        _Track      = ghostData.Track;
        _FinishTime = ghostData.FinishTime;

        _ReplayData = ghostData.RawData;

        BuildPackage();
    }
 public void StartRecording()
 {
     if (recording)
     {
         return;
     }
     recording    = true;
     recordedData = new GhostReplayData(recordingInterval, GlobalGameData.currentInstance.m_playerData_eventActive.GetSeed(),
                                        GlobalGameData.currentInstance.m_playerData_eventActive.GetGamemode(), GlobalGameData.currentInstance.GetPlayerName(),
                                        GlobalGameData.currentInstance.GetCarInUse().GetSkinId(), GlobalGameData.currentInstance.GetCarInUse().GetModelId());
     StartCoroutine("RecordData");
     print("[REPLAY] Recording ghost data.");
 }
    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");
    }
    private void HandleOnSpawnPlayer()
    {
        RS_GamePlayController.Instance.Player.OnThrottlePress   += HandleOnThrottlePress;
        RS_GamePlayController.Instance.Player.OnThrottleRelease += HandleOnThrottleRelease;
        RS_GamePlayController.Instance.Player.OnGearUp          += HandleOnGearUp;
        RS_GamePlayController.Instance.Player.OnGearDown        += HandleOnGearDown;

        NewGhostData = new GhostReplayData();
        NewGhostData.SetCarId(RS_GameData.MenuCarId);
        NewGhostData.SetCarLevel(2);
        NewGhostData.SetTrack("Desert");

        if (!IsGhostExist)
        {
            IsGhostExist = true;
            CreateGhostPlayer();
        }
    }
示例#6
0
 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 ();
 }
    //--------------------------------------
    // Action Hadnlers
    //--------------------------------------


    private void HandleGhostInfoThoroughlyFull(GhostReplayData obj)
    {
        ShowFinishScreen();
    }