24 lines
635 B
C#
24 lines
635 B
C#
using UnityEngine;
|
|
|
|
public class StartTrigger : MonoBehaviour
|
|
{
|
|
private TetrominoSpawnManager tetrominoSpawnManager;
|
|
private bool gameStarted;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
tetrominoSpawnManager = FindObjectOfType<TetrominoSpawnManager>();
|
|
}
|
|
|
|
private void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
if (other.gameObject.tag == "Player" && !gameStarted)
|
|
{
|
|
GetComponent<AudioSource>().Play();
|
|
tetrominoSpawnManager.spawnTetromino();
|
|
gameStarted = true;
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|