// Use this for initialization void Start() { minHeight = transform.position.y; heightChange= transform.position.y; maxHeight = maxHeightPoint.transform.position.y; maxHeightChange = 2.5f; platformWidths = new float[theObjectPools.Length]; for (int i=0; i<theObjectPools.Length; i++) { platformWidths[i]=theObjectPools[i].pooledObject.GetComponent<BoxCollider2D>().size.x; } theCoinGenerator = FindObjectOfType<CoinGenerator> (); theSpikeGenerator = FindObjectOfType<SpikeGenerator> (); }
void Start() { scorepoint = FindObjectOfType <Score>(); platformwidth = new float[ObjectPools.Length]; for (int i = 0; i < ObjectPools.Length; i++) { platformwidth[i] = ObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x; } Airplatformwidth = new float[AirObjectPools.Length]; for (int j = 0; j < AirObjectPools.Length; j++) { Airplatformwidth[j] = AirObjectPools[j].pooledObject.GetComponent <BoxCollider2D>().size.x; } minHeight = transform.position.y; maxHeight = maxHeightPoint.position.y; screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z)); playerDistance = transform.position.x - player.position.x; CoinGenerator = FindObjectOfType <CoinGenerator>(); EnemyGenerator = FindObjectOfType <EnemyGenerator>(); SpikeGenerator = FindObjectOfType <SpikeGenerator>(); spike = FindObjectOfType <Spike>(); }