49 lines
970 B
C#
49 lines
970 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class CreditsScript : MonoBehaviour
|
|
{
|
|
|
|
public float scrollSpeed;
|
|
private float maxScrollSpeed = 300f;
|
|
[SerializeField] public float maxYPosition;
|
|
|
|
private RectTransform rectTransform;
|
|
|
|
void Start()
|
|
{
|
|
rectTransform = GetComponent<RectTransform>();
|
|
}
|
|
|
|
|
|
void Update()
|
|
{
|
|
rectTransform.anchoredPosition += new Vector2(0, scrollSpeed * Time.deltaTime);
|
|
|
|
if (Input.GetKeyDown(KeyCode.KeypadEnter))
|
|
{
|
|
SceneManager.LoadSceneAsync(0);
|
|
}
|
|
|
|
if (Input.GetKey(KeyCode.Space))
|
|
{
|
|
scrollSpeed += 50;
|
|
|
|
if (scrollSpeed > maxScrollSpeed)
|
|
{
|
|
scrollSpeed = maxScrollSpeed;
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
scrollSpeed = 100f;
|
|
}
|
|
|
|
if (transform.position.y >= maxYPosition)
|
|
{
|
|
Debug.Log("The End");
|
|
}
|
|
}
|
|
}
|