diff --git a/Assets/Scenes/level1.unity b/Assets/Scenes/level1.unity index b7d6d3a..cd967fb 100644 --- a/Assets/Scenes/level1.unity +++ b/Assets/Scenes/level1.unity @@ -1726,7 +1726,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1149029299} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -41, y: 2.388, z: 0} + m_LocalPosition: {x: -41, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} diff --git a/Assets/Scripts/startTrigger.cs b/Assets/Scripts/startTrigger.cs new file mode 100644 index 0000000..db0f535 --- /dev/null +++ b/Assets/Scripts/startTrigger.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class startTrigger : MonoBehaviour +{ + private tetrominoSpawnManager TetrominoSpawnManager; + + // Start is called before the first frame update + void Start() + { + TetrominoSpawnManager = FindObjectOfType(); + } + + private void OnTriggerEnter2D(Collider2D other) + { + if (other.gameObject.tag == "Player") + { + TetrominoSpawnManager.spawnTetromino(); + gameObject.SetActive(false); + } + } +} diff --git a/Assets/Scripts/startTrigger.cs.meta b/Assets/Scripts/startTrigger.cs.meta new file mode 100644 index 0000000..3b0039f --- /dev/null +++ b/Assets/Scripts/startTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07be5b25cb965ac52b42bcc180bd0f59 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/tetrominoSpawnManager.cs b/Assets/Scripts/tetrominoSpawnManager.cs index 2cf0a6c..1e69997 100644 --- a/Assets/Scripts/tetrominoSpawnManager.cs +++ b/Assets/Scripts/tetrominoSpawnManager.cs @@ -15,12 +15,6 @@ public class tetrominoSpawnManager : MonoBehaviour private int nextTetromino = 0; private GameObject nextTetrominoObject; - // Start is called before the first frame update - void Start() - { - spawnTetromino(); - } - public void spawnTetromino() { nextTetromino = Random.Range(1, 7);