Ejemplo n.º 1
0
    /// <summary>
    /// Event that fires when the replay is finished.
    /// </summary>
    public void replayFinished()
    {
        //stop replay
        vcr.Stop();

        //move to spawn position and hide the ship (for next replay)
        rigidbody.position = transform.position = GetComponent <Racer>().spawnPosition;
        rigidbody.velocity = Vector3.zero;
        transform.GetComponentInChildren <MeshRenderer>().enabled = false;
        transform.GetComponentInChildren <ParticleSystem>().Stop();

        //disable script
        GetComponent <Racer>().enabled = false;
    }
Ejemplo n.º 2
0
    public void StartRecording()
    {
        if (isRecording)
        {
            playerVCR.Stop();
        }
        else
        {
            recordingStartPos = playerVCR.transform.position;
            recordingStartRot = playerVCR.transform.rotation;
            playerVCR.NewRecording();
        }

        isRecording = !isRecording;
    }
Ejemplo n.º 3
0
        void Update()
        {
            if (haveAbility)
            {
                if (abilityFirstActivate)
                {
                    StartRecording();
                    abilityFirstActivate = false;
                }

                if (playerVCR.GetRecording() != null)
                {
                    if ((playerVCR.GetRecording().frames.Count / recFPS) < minRewind)
                    {
                        canActivate = false;
                    }
                    else
                    {
                        canActivate = true;
                    }
                }
                else
                {
                    Debug.Log("There is no player recording to access!");
                }

                if (allRecordedClones.Count < maxActiveClones && canActivate)
                {
                    if (hardInput.GetKeyDown("RecordPlayer"))
                    {
                        canDeactivate = false;

                        if (firstPress)
                        {
                            Clock globalClock = Timekeeper.instance.Clock("Root");
                            firstPress     = false;
                            rewindStart    = true;
                            countDownEarly = false;
                            playerVCR.Stop();
                            globalClock.localTimeScale = -1;
                            playerVCR.gameObject.GetComponent <CameraBehaviour>().isActive = false;

                            Debug.Log("Testing - There are " + playerVCR.GetRecording().recordingLength + " recorded! - Activated Start");
                            // Starts the rewinding of the frames
                            InvokeRepeating("RewindToFrame", 0.0f, 1.0f / recFPS);

                            playerVCR.gameObject.GetComponent <PlayerBehaviour>().stopKeyInput = true;
                            playerCamera.gameObject.GetComponent <ChangeCameraEffects>().ChangeFOV(100, 2);
                            playerCamera.gameObject.GetComponent <ChangeCameraEffects>().ChangeGrain(1, 2);
                            AudioManager.instance.Play("Ability_TimeRewind");

                            if (minDelay != null)
                            {
                                StopCoroutine(minDelay);
                            }

                            minDelay = StartCoroutine(MinRewindDelay(minRewind));
                        }
                    }
                    if (hardInput.GetKeyUp("RecordPlayer") && canDeactivate && haveAbility)
                    {
                        canDeactivate = false;

                        if (!triggeredEarly)
                        {
                            RewindStuff();
                        }
                        else
                        {
                            triggeredEarly = false;
                        }
                    }
                    if (!hardInput.GetKey("RecordPlayer") && canDeactivate && haveAbility)
                    {
                        canDeactivate = false;

                        if (!triggeredEarly)
                        {
                            RewindStuff();
                        }
                        else
                        {
                            triggeredEarly = false;
                        }
                    }
                }
                else
                {
                    if (hardInput.GetKeyDown("RecordPlayer"))
                    {
                        AudioManager.instance.Play("Ability_TimeRewindDisabled");

                        // Start new recording, to make sure it doesn't get stuck.
                        Debug.Log("There are " + playerVCR.GetRecording().frames.Count + " frames in current recording!");
                        if (playerVCR.GetRecording().recordingLength < 5)
                        {
                            StartRecording();
                        }
                    }
                }
            }
            else
            {
                if (hardInput.GetKeyDown("RecordPlayer"))
                {
                    AudioManager.instance.Play("Ability_TimeRewindDisabled");
                    Debug.Log("You do not have the ability!");
                }
            }

            // if (hardInput.GetKeyDown("SaveRecordings"))
            // {
            //     SaveRecordingsToFile();
            // }
        }