// Update is called once per frame
    void Update()
    {
        // Only generate sheep once, and only generate them after some time has elapsed since
        // the game started to allow the terrain to have generated.  This is because we trace
        // a ray into the ground to see what height the ground is so the sheep drops from just
        // above it
        if (!sheepGenerated && Time.time > GlobalVariables.TIME_FOR_FIRST_TERRAIN_GENERATION_IN_SECONDS)
        {
            SheepGenerator.GenerateSheep(sheepPrefab, sheepContainer);

            sheepGenerated = true;
        }
    }
Exemple #2
0
    private void PlatformSetup()
    {
        platformWidths = new float[objPlatformPooler.Length];

        //Get platform prefab widths
        for (int i = 0; i < objPlatformPooler.Length; i++)
        {
            platformWidths[i] = objPlatformPooler[i].platformPool.GetComponent <BoxCollider2D>().size.y;
        }

        //restrict how far the platform can instantiate at
        minX = minXPoint.position.x;
        maxX = maxXPoint.position.x;

        sheepGenerator = FindObjectOfType <SheepGenerator>();
    }