// Update is called once per frame
    void Update()
    {
        scrollSpeedup = scoreCounter.Score() / scrollSpeedupDivisor;
        Vector2 scrollVector = new Vector3(0.0f, (baseScrollSpeed + scrollSpeedup) * Time.deltaTime * -1);

        //Scroll the blocks
        foreach (GameObject gameBlock in gList)
        {
            try
            {
                gameBlock.transform.Translate(scrollVector);
            }
            catch (MissingReferenceException mre) {}
        }
        //gQueue = bScroller.GetBlockQueue();

        //Scroll objects that will never be in the blockQueue because they aren't procedurally generated
        //(E.g. starting platform)
        if (scrollingObjects != null && destroyedFirstBlock)
        {
            foreach (GameObject scroller in scrollingObjects)
            {
                if (scroller)
                {
                    scroller.transform.Translate(scrollVector);
                }
            }
        }
    }
Esempio n. 2
0
 // Update
 void Update()
 {
     if (curHealth < 1)
     {
         if (spawnDebris == true)
         {
             Instantiate(destroyedversion, transform.position, transform.rotation);
             Destroy(gameObject);
             UpdateScore.Score(scoreValue);
         }
         else
         {
             Destroy(gameObject);
         }
     }
 }