private void Awake() { material = GetComponent <Renderer>().material; if (!isIndependant) { obstacles = obstacleObj.GetComponent <ObstaclesScrolling>(); offset = new Vector2(obstacles.speed / 13, 0); } }
// Start is called before the first frame update void Start() { backgroundScrolling = background.GetComponent <BackgroundScrolling>(); obtaclesScrolling = obtacles.GetComponent <ObstaclesScrolling>(); groundScrolling = ground.GetComponent <GroundScrolling>(); dict[0] = 3f; dict[1] = 3.5f; dict[2] = 4f; dict[3] = 4.5f; dict[4] = 5f; dict[5] = 5.5f; dict[6] = 6f; dict[7] = 6.5f; obtaclesScrolling.speed = dict[0]; groundScrolling.updateSpeed(); }