Ejemplo n.º 1
0
    void pickupCreamFilling(CreamFilling creamFilling)
    {
        if (creamState)
        {
            extendCreamFillingBoost();
        }
        else
        {
            currentCreamPickups++;
            Debug.Log("picked up " + currentCreamPickups + " pickups");
            if (currentCreamPickups >= creamPickupsNeeded)
            {
                startCreamFillingBoost();
            }
        }

        Destroy(creamFilling.gameObject);
    }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Sprinkle sprinkle = collider.gameObject.GetComponent <Sprinkle>();

        if (sprinkle != null)
        {
            GameObject.Find("GUI").BroadcastMessage("addScore", sprinkle.getPointWorth());
            AudioSource noise = GetComponents <AudioSource>()[0];
            noise.Play();

            var sprinkleSprite = sprinkle.gameObject.GetComponent <SpriteRenderer>().sprite;
            gameObject.BroadcastMessage("addSprinklesToDonut", sprinkleSprite);

            Destroy(sprinkle.gameObject);
        }

/*
 *              Sugarpile sugarpile = collider.gameObject.GetComponent<Sugarpile>();
 *              if (sugarpile != null) {
 *                      //AudioSource noise = GetComponents<AudioSource>()[0];
 *                      //noise.Play();
 *
 *                      //var sugarpileSprite = sugarpile.gameObject.GetComponent<SpriteRenderer>().sprite;
 *                      //gameObject.BroadcastMessage("addSugarPileToDonut", sugarpileSprite);
 *
 *                      Debug.Log("Hit sugarpile");
 *                      slowedDownAmount = slowedDownAmountTotal = sugarpile.getSlowDownModifier();
 *                      slowedDownCooldown = slowedDownTimeTotal = sugarpile.getSlowDownTimeLength();
 *                      Destroy(sugarpile.gameObject);
 *              }
 */
        Nut nut = collider.gameObject.GetComponent <Nut> ();

        if (nut != null)
        {
            pickupNut(nut);
        }

        CreamFilling creamFilling = collider.gameObject.GetComponent <CreamFilling>();

        if (creamFilling)
        {
            pickupCreamFilling(creamFilling);
        }

        DonutEnemy de = collider.gameObject.GetComponent <DonutEnemy>();

        if (de != null)
        {
            getHitByDonutEnemy(de);
            //if (de.getSize() > transform.localScale.x) { // its bigger, player loses
            //GameObject.Find("GUI").GetComponentInChildren<InGameStates>().loseGame();
            //GetComponent<Controls>().setGameOver();

            /*} else { // its smaller, player gets bigger
             *      float newSize = transform.localScale.x + sizePerEat;
             *      transform.localScale = new Vector3(newSize, newSize, 1.0f);
             *      GameObject.Find("GUI").BroadcastMessage("addScore", 10);
             *      Destroy(de.gameObject);
             * }*/
        }
    }
Ejemplo n.º 3
0
    void pickupCreamFilling(CreamFilling creamFilling)
    {
        if (creamState) {
            extendCreamFillingBoost();
        } else {
            currentCreamPickups++;
            Debug.Log("picked up " + currentCreamPickups + " pickups");
            if (currentCreamPickups >= creamPickupsNeeded) {
                startCreamFillingBoost();
            }
        }

        Destroy(creamFilling.gameObject);
    }