Added comments to everything

This commit is contained in:
djkellerman
2025-04-18 15:54:50 -04:00
parent a0305ea0e9
commit 213bb2d14b
39 changed files with 3166 additions and 1796 deletions

View File

@@ -1,24 +1,48 @@
using UnityEngine; using Game; using Music; using Player;
using UnityEngine;
using Game;
using Music;
using Player;
namespace Game
{
public class InfiniteScroll : MonoBehaviour
{
public float speed;
public float start;
public float end;
private void Update() // Moves the background
/// <summary>
/// This class handles the infinite scrolling effect for the background.
/// </summary>
public class InfiniteScroll : MonoBehaviour
{
if (transform.position.x > end)
{
transform.position = new Vector3(start, transform.position.y, transform.position.z);
}
else if (transform.position.x < start)
{
transform.position = new Vector3(end, transform.position.y, transform.position.z);
}
/// <summary>
/// The speed at which the background scrolls.
/// </summary>
public float speed;
transform.position += speed * Time.deltaTime * Vector3.right;
/// <summary>
/// The starting position of the background.
/// </summary>
public float start;
/// <summary>
/// The ending position of the background.
/// </summary>
public float end;
/// <summary>
/// Updates the position of the background to create a scrolling effect.
/// </summary>
private void Update()
{
// If the background moves past the end position, reset it to the start position
if (transform.position.x > end)
{
transform.position = new Vector3(start, transform.position.y, transform.position.z);
}
// If the background moves past the start position, reset it to the end position
else if (transform.position.x < start)
{
transform.position = new Vector3(end, transform.position.y, transform.position.z);
}
// Move the background to the right based on the speed and time elapsed
transform.position += speed * Time.deltaTime * Vector3.right;
}
}
}
}