예제 #1
0
    /// <summary>
    /// Replays the recording of the player.
    /// </summary>
    void Replay()
    {
        // Only replay when having values
        if (pointsInTime.Count > 0)
        {
            PointInTimeAvatar currentPoint = pointsInTime[pointsInTime.Count - 1];

            transform.position = currentPoint.position;
            avatar.State       = currentPoint.state;
            //Debug.Log(currentPoint.sprite);
            avatarRenderer.sprite = currentPoint.sprite;

            pointsInTime.RemoveAt(pointsInTime.Count - 1);
        }
        else
        {
            StopReplay();
        }
    }
예제 #2
0
    /// <summary>
    /// Rewinds the object in time.
    /// </summary>
    void Rewind()
    {
        // Only rewind when having values
        if (pointsInTime.Count > 0)
        {
            //PointInTimeAvatar currentPoint = pointsInTime[0];
            PointInTimeAvatar currentPoint = pointsInTime[rewindPoints];

            transform.position = currentPoint.position;
            avatar.State       = currentPoint.state;
            //Debug.Log(currentPoint.sprite);
            avatarRenderer.sprite = currentPoint.sprite;

            //pointsInTime.RemoveAt(0); // Change
            rewindPoints++; // Change
        }
        else
        {
            StopRewind();
        }
    }