public void StartObstacleManager() { for (int i = 0; i < numberOfObstacles; i++) { obstacles[i] = Instantiate(obstacle, new Vector2(0, 50 + i * gapBetweenObstacles), this.transform.rotation); ObstacleStyleSetter obs = obstacles[i].GetComponent <ObstacleStyleSetter>() as ObstacleStyleSetter; passableChildIndex = Random.Range(0, 3); obs.SetSprites(passableChildIndex); resetPassableChild(i, passableChildIndex); resetVelocities(i); } if (SceneManager.GetActiveScene().name != "tutorial") { StartCoroutine("ObstaclesUpdater"); } levelShift = false; obstaclesCount = numberOfObstacles; ObstacleStyleSetter.style = ObstacleStyleSetter.Style.diffShape; levelChangeOnCountOf = levelChangeOnCountOf_pb + Random.Range(0, 10); powerUpSpawnOnCountOf = levelChangeOnCountOf / 2; }
private void resetSprites(int i, int passableChildIndex) { ObstacleStyleSetter obs = obstacles[i].GetComponent <ObstacleStyleSetter>() as ObstacleStyleSetter; obs.SetSprites(passableChildIndex); }