// Update is called once per frame
    void Update()
    {
        crLap = target.GetComponent <Player>().CurrentLap;

        if (crLap == int.Parse(name))
        {
            if (target.transform.position != lastRecorededGhostTransform.position || target.transform.rotation != lastRecorededGhostTransform.rotation)
            {
                var newGhostTransform = new GhostTransform(target.transform);
                recordedGhostTransforms.Add(newGhostTransform);

                lastRecorededGhostTransform = newGhostTransform;
            }
        }

        if (crLap != lastLap)
        {
            if (crLap - int.Parse(name) > 0)
            {
                Play();
            }
        }

        lastLap = crLap;
    }
Ejemplo n.º 2
0
    void FixedUpdate()
    {
        if (recording == true)
        {
            //if (playerTrans.position != lastRecordedGhostTransform._position || playerTrans.rotation != lastRecordedGhostTransform._rotation)
            //{
            var newGhostTransform = new GhostTransform(playerTrans);
            recordedGhostTransforms.Add(newGhostTransform);

            lastRecordedGhostTransform = newGhostTransform;
            //}
        }
    }
Ejemplo n.º 3
0
    IEnumerator StartRecording()
    {
        while (recording)
        {
            if (kart.position != lastRecordedGhostTransform.position || kart.rotation != lastRecordedGhostTransform.rotation)
            {
                var newGhostTransform = new GhostTransform(kart);
                recordedGhostTransforms.Add(newGhostTransform);

                lastRecordedGhostTransform = newGhostTransform;
            }
            yield return(new WaitForSeconds(0.01F));
        }

        isRecordingStarted = false;
    }
Ejemplo n.º 4
0
 private void Update()
 {
     if (recording == true)
     {
         if (Ball.position != LastRecordedGhostTransform.Position || Ball.rotation != LastRecordedGhostTransform.Rotation)
         {
             var newGhostTransform = new GhostTransform(Ball);
             recordedGhostTranforms.Add(newGhostTransform);
             LastRecordedGhostTransform = newGhostTransform;
         }
     }
     if (playing == true)
     {
         Play();
     }
 }