Esempio n. 1
0
 void Update()
 {
     if (btnScript.isPressed())
     {
         if (TILT)
         {
             perDataScript.setTilt();
             if (perDataScript.getTilt() == 1)
             {
                 sprRndr.sprite = img;
             }
             else
             {
                 sprRndr.sprite = notImg;
             }
         }
         if (MUTE)
         {
             perDataScript.setMute();
             if (perDataScript.getMute() == 1)
             {
                 sprRndr.sprite = img;
                 soundMan.Unmute();
             }
             else
             {
                 sprRndr.sprite = notImg;
                 soundMan.Mute();
             }
         }
     }
 }
Esempio n. 2
0
 void Update()
 {
     if (btnScript.isPressed())
     {
         ShowNext();
     }
 }
Esempio n. 3
0
 void Update()           // Show help menu on button press
 {
     if (btnScript.isPressed())
     {
         if (pauseObj != null)
         {
             if (pauseObj)
             {
                 pauseScript = pauseObj.GetComponent <ButtonScript>();
             }
             //pauseScript.OnMouseUp();
         }
         //disableObj.SetActive(false);
         AssumingController.StartHalp();
     }
 }
Esempio n. 4
0
    void Update()
    {
        if (btnScript.isPressed())      // Change sprite on button press
        {
            if (this.GetComponent <SpriteRenderer>() != null)
            {
                this.GetComponent <SpriteRenderer>().sprite = pressSprite;
            }
            if (disableObjs.Count > 0)      // Disable/enable objects
            {
                for (int i = 0; i < disableObjs.Count; i++)
                {
                    disableObjs[i].SetActive(false);
                }
            }
            if (enableObjs.Count > 0)
            {
                for (int i = 0; i < enableObjs.Count; i++)
                {
                    enableObjs[i].SetActive(true);
                }
            }
            switch (buttonName)     // Take action based on purpose
            {
            case "resume":
                pauseScript.DoMouseUp();
                break;

            case "home":
                if (death)
                {
                    if ((PersistentData.Instance.GetDeaths() % 3 == 0) && (PersistentData.Instance.GetDeaths() > 0))
                    {
                        ShowAd();
                    }
                }
                Application.LoadLevel(sceneLoad);
                break;

            case "retry":
                if (death)
                {
                    if ((PersistentData.Instance.GetDeaths() % 3 == 0) && (PersistentData.Instance.GetDeaths() > 0))
                    {
                        ShowAd();
                    }
                }
                Application.LoadLevel(sceneLoad);
                break;

            case "transition":
                if (removeAd)
                {
                    ad.GetComponent <ShowBanner>().Destroy();
                }
                transitioner.GetComponent <LoadScene>().SetIn(true);
                transitioner.GetComponent <EMTransition>().gradationTexture = transitionTextures[0];
                transitioner.GetComponent <EMTransition>().Play();
                break;
            }
        }
    }
Esempio n. 5
0
    void Update()                          //  *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   Update
    {
        if (pauseButtonScript.isPressed()) //  .   .   .   .   .   .   .   .   .   .   .   .   Detect pause press and show pause screen
        {
            if (paused)
            {
                for (int i = 0; i < pauseScreen.Count; i++)
                {
                    pauseScreen[i].SetActive(false);
                }
                paused = false;
            }
            else
            {
                for (int i = 0; i < pauseScreen.Count; i++)
                {
                    pauseScreen[i].SetActive(true);
                }
                paused = true;
            }
        }
        for (int iJ = 0; iJ < keyJump.Length; iJ++)     //  .   .   .   .   .   .   .   .   .   .   Detect jump trigger
        {
            if ((Input.GetKeyDown(keyJump[iJ])) || (screenButtonScript.isPressed()))
            {
                bJump = true;
            }
        }
        for (int iR = 0; iR < keyRight.Length; iR++)    //  .   .   .   .   .   .   .   .   .   .   Detect right trigger
        {
            if ((Input.GetKey(keyRight[iR])) || (rightButtonScript.isHeld()))
            {
                fRight = 1.0f;
                fLeft  = 0.0f;
            }
            else
            {
                fRight = 0.0f;
            }
        }

        for (int iL = 0; iL < keyLeft.Length; iL++)     //  .   .   .   .   .   .   .   .   .   .   Detect left trigger
        {
            if ((Input.GetKey(keyLeft[iL])) || (leftButtonScript.isHeld()))
            {
                fLeft  = 1.0f;
                fRight = 0.0f;
            }
            else
            {
                fLeft = 0.0f;
            }
        }
        if (useTilt)
        {
            if ((fLeft == 0.0f) && (fRight == 0.0f))
            {
                float phoneTiltx = Input.acceleration.x * tiltSpeed;   //  .   .   .   .   .   .   .   .   .   .   Tilt controls
                float phoneTilty = -Input.acceleration.x * tiltSpeed;
                if (fLeft == 0.0f)
                {
                    if (phoneTiltx > tiltDeadzone)
                    {
                        fRight = phoneTiltx;
                    }
                }
                if (fRight == 0.0f)
                {
                    if (phoneTilty > tiltDeadzone)
                    {
                        fLeft = phoneTilty;
                    }
                }
            }
        }
    }