Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (ftScript == null)
        {
            ftScript = gameObject.GetComponent <FloatingText> ();
        }
        if (controlScript == null)
        {
            controlScript = GameObject.Find("Controller").GetComponent <Controller> ();
        }
        if (target != null)
        {
            transform.position = Vector3.MoveTowards(transform.position, target.transform.position, Time.deltaTime * speed);
        }
        if (teeterScript == null)
        {
            teeterScript = GameObject.Find("Teeter(Player)").GetComponent <TeeterBase> ();
        }

        if (collided && !processed)
        {
            processed = true;
            removePowerUp();
        }
    }
    //Roll the cart wheels in the correct direction of movement and speed that the user inputs
    void Start()
    {
        controlEmpty = GameObject.Find("Control Empty 1");
        teeterScript = GameObject.Find("Teeter(Player)").GetComponent <TeeterBase> ();
        controller   = GameObject.Find("Controller");
        fillL        = GameObject.Find("TopFillL");
        fillM        = GameObject.Find("TopFillM");
        fillR        = GameObject.Find("TopFillR");
        cartArray    = new Sprite[4];
        index        = 0;
        count        = 1;

        cartArray[0] = cart1;
        cartArray[1] = cart2;
        cartArray[2] = cart3;
        cartArray[3] = cart4;
    }
    // Update is called once per frame
    void Update()
    {
        if (teeterScript != null)
        {
            teeterScript.baseImageHeight = imagePanel.transform.position.y;
            teeterScript.checkScrollBounds();
        }
        else
        {
            teeterScript = GameObject.Find("Teeter(Player)").GetComponent <TeeterBase> ();
        }

        //Setting the fill or no fill holes in the cart top
        if (controller.GetComponent <Controller>().fallingDude.GetComponent <Bouncer>().inBigMode())
        {
            fillPowerUpHolders(2, true);
        }
        else
        {
            fillPowerUpHolders(2, false);
        }
        if (controller.GetComponent <BalloonMovement>().bombIsSet())
        {
            fillPowerUpHolders(1, true);
        }
        else
        {
            fillPowerUpHolders(1, false);
        }
        if (controller.GetComponent <Controller>().fallingDude.GetComponent <Bouncer>().getGreenPowerUp())
        {
            fillPowerUpHolders(3, true);
        }
        else
        {
            fillPowerUpHolders(3, false);
        }
    }