using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Credits : MonoBehaviour {

    public GameObject credits;
    public float scrollSpeed;

    public bool scrolling = false;
    private Vector3 pos;

    public void Start()
    {
        pos = credits.transform.position;
    }

    public void StartCredits()
    {
        if (!scrolling)
        {
            Debug.Log("Starting Credits");
            credits.transform.position = pos;
            scrolling = true;
        }
    }

    public void StopCredits()
    {
        if (scrolling)
        {
            Debug.Log("Stop Credits");
            scrolling = false;
        }
    }

    public void Update()
    {
        if (scrolling)
        {
            credits.transform.position += Vector3.up * Time.deltaTime * scrollSpeed;
        }
    }
}
