// Use this for initialization
    void Start()
    {
        platformWidth = thePlatform.GetComponent <BoxCollider2D>().size.x;

        platformWidths = new float[theObjectPool.Length];

        for (int i = 0; i < theObjectPool.Length; i++)
        {
            platformWidths[i] = theObjectPool[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }


        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        theCoinGenerator = FindObjectOfType <coinGenerator>();
    }
    // Use this for initialization
    void Start()
    {
        // platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;

        PlatformWidths = new float[theObjectPools.Length];

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            PlatformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x - 2;
        }

        _minHeight = transform.position.y;

        _maxHeight = _maxHeightPoint.position.y;

        coinGen = FindObjectOfType <coinGenerator>();
    }
Exemple #3
0
    void Start()
    {
        //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x; //To get the size of 'Platform 6x1'.

        skyGenPoint = Mathf.Round(generationPoint.position.x + 12.8f);           //To create a sky at
        Instantiate(theSky, generationPoint.position, generationPoint.rotation); //the start of program.

        platformWidths = new float[thePlatforms.Length];

        for (int i = 0; i < thePlatforms.Length; i++)
        {
            platformWidths[i] = thePlatforms[i].GetComponent <BoxCollider2D>().size.x; //To get the size of platforms added to 'thePlatforms' array
        }

        minHeight        = transform.position.y;
        maxHeight        = MaxHeightPoint.position.y;
        theCoinGenerator = FindObjectOfType <coinGenerator> ();
    }