using UnityEngine;
using Game;
using Music;
using Player;
namespace Game
{
///
/// This class helps manage positions for the GameManager during development.
/// It allows adding hat spawn positions and player spawn positions directly in the editor.
///
[ExecuteAlways]
public class GameManagerHelper : MonoBehaviour
{
///
/// If true, adds the current position of the "HELPER" object to the hat spawn positions in the GameManager.
///
public bool addHatPosition;
///
/// If true, sets the current position of the "HELPER" object as the player spawn position in the GameManager.
///
public bool addSpawnPosition;
///
/// Checks for changes to the addHatPosition and addSpawnPosition flags every frame.
/// Updates the GameManager with the corresponding positions when the flags are set.
///
private void Update()
{
// Add the current position of the "HELPER" object to the hat spawn positions
if (addHatPosition)
{
addHatPosition = false; // Reset the flag
GetComponent().hatSpawnPositions.Add(GameObject.Find("HELPER").transform.position);
}
// Set the current position of the "HELPER" object as the player spawn position
if (addSpawnPosition)
{
addSpawnPosition = false; // Reset the flag
GetComponent().spawnPosition = GameObject.Find("HELPER").transform.position;
}
}
}
}