// Start is called before the first frame update void Start() { instance = this; Vector3 spawnPosition = startPoint.position; int tilesWithNoObstaclesTmp = tilesWithoutObstacles; for (int i = 0; i < tilesToPreSpawn; i++) { spawnPosition -= tilePrefab.startPoint.localPosition; SC_PlatformTile spawnedTile = Instantiate(tilePrefab, spawnPosition, Quaternion.identity) as SC_PlatformTile; if (tilesWithNoObstaclesTmp > 0) { spawnedTile.DeactivateAllObstacles(); tilesWithNoObstaclesTmp--; } else { spawnedTile.ActivateRandomObstacle(); } spawnPosition = spawnedTile.endPoint.position; spawnedTile.transform.SetParent(transform); spawnedTiles.Add(spawnedTile); } }
public void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { Debug.Log("Hit Player"); SC_GroundGenerator sc = FindObjectOfType <SC_GroundGenerator>(); sc.gameOver = true; } }
// Start is called before the first frame update void Start() { instance = this; Vector3 spawnPosition = startPoint.position; for (int i = 0; i < tilesToPreSpawn; i++) { int rand = Random.Range(0, tilePrefabs.Length); spawnPosition -= tilePrefabs[rand].startPoint.localPosition; SC_PlatformTile spawnedTile = Instantiate(tilePrefabs[rand], spawnPosition, Quaternion.identity) as SC_PlatformTile; spawnPosition = spawnedTile.endPoint.position; spawnedTile.transform.SetParent(transform); spawnedTiles.Add(spawnedTile); } }
// Start is called before the first frame update void Start() { bh = FindObjectOfType <beatHitter>(); sc = FindObjectOfType <SC_GroundGenerator>(); }