Start game only when player finishes falling.

This commit is contained in:
Kaj Forney 2021-11-01 01:54:04 -06:00
parent 0f47ff4024
commit 5096e4ab35
Signed by: kforney
GPG key ID: 3AB4E2E04CEF656F
4 changed files with 36 additions and 7 deletions

View file

@ -1726,7 +1726,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1149029299} m_GameObject: {fileID: 1149029299}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 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_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}

View file

@ -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<tetrominoSpawnManager>();
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Player")
{
TetrominoSpawnManager.spawnTetromino();
gameObject.SetActive(false);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07be5b25cb965ac52b42bcc180bd0f59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -15,12 +15,6 @@ public class tetrominoSpawnManager : MonoBehaviour
private int nextTetromino = 0; private int nextTetromino = 0;
private GameObject nextTetrominoObject; private GameObject nextTetrominoObject;
// Start is called before the first frame update
void Start()
{
spawnTetromino();
}
public void spawnTetromino() public void spawnTetromino()
{ {
nextTetromino = Random.Range(1, 7); nextTetromino = Random.Range(1, 7);