Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Const.TEST_CONNECTION)
        {
            if (!doneTesting)
            {
                string str = Utilities.check_InternetConnection();
                if (str.Length == 0)                  //we're good to go
                {
                    doneTesting    = true;
                    titleText.text = Database.titleText_main;
                }
                else
                {
                    titleText.text = str;
                }
            }
        }

        play_audio();

        //Check if we are running either in the Unity editor or in a standalone build.
                #if UNITY_STANDALONE || UNITY_WEBPLAYER
        if (eh.isActivate())
        {
            InputEvent ie = eh.getEventData();
            switch (ie.keycode)
            {
            case KeyCode.RightArrow:
                GameMode.instance.gamemode = GameMode.Game_Mode.CONTINUE;
                SceneManager.LoadScene("Main_pre");
                //toMainflag = true;
                //cur_clip = 0;
                SoundManager.instance.PlayVoice(Database.instance.TitletoMainClips[1], true);
                //SoundManager.instance.PlaySingle(swipeRight);
                break;

            case KeyCode.LeftArrow:
                GameMode.instance.gamemode = GameMode.Game_Mode.TUTORIAL;
                SceneManager.LoadScene("Main");
                //SoundManager.instance.PlayVoice(to_tutorial, true);
                //SoundManager.instance.PlaySingle(swipeLeft);
                break;

            case KeyCode.UpArrow:            //Up
                SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                if (!listenToCmd)
                {
                    listenToCmd  = true;
                    reset_audio  = true;
                    cur_clip     = 0;
                    cmd_cur_clip = 0;
                }
                else
                {
                    listenToCmd  = false;
                    reset_audio  = true;
                    cur_clip     = 0;
                    cmd_cur_clip = 0;
                }
                break;

            case KeyCode.DownArrow:            //BACK
                SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                //credit
                break;

            default:
                break;
            }
        }

        //Check if we are running on iOS, Android, Windows Phone 8 or Unity iPhone
                #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Screen.orientation  = ScreenOrientation.Landscape;

        if (eh.isActivate())
        {
            InputEvent ie = eh.getEventData();

            if ((ie.touchNum == 1) && (!ie.isRotate))
            {
                if (ie.isRight)
                {
                    GameMode.instance.gamemode = GameMode.Game_Mode.CONTINUE;
                    SceneManager.LoadScene("Main_pre");
                    SoundManager.instance.PlayVoice(Database.instance.TitletoMainClips[0], true);
                }
                else if (ie.isLeft)
                {
                    GameMode.instance.gamemode = GameMode.Game_Mode.TUTORIAL;
                    SceneManager.LoadScene("Main");
                }
                else if (ie.isUp)
                {
                    SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                    if (!listenToCmd)
                    {
                        listenToCmd  = true;
                        reset_audio  = true;
                        cur_clip     = 0;
                        cmd_cur_clip = 0;
                    }
                    else
                    {
                        listenToCmd  = false;
                        reset_audio  = true;
                        cur_clip     = 0;
                        cmd_cur_clip = 0;
                    }
                }
                else if (ie.isDown)
                {
                    SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                    //credit
                }
            }
        }
                #endif //End of mobile platform dependendent compilation section started above with #elif
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        play_audio();

        //Check if we are running either in the Unity editor or in a standalone build.
                #if UNITY_STANDALONE || UNITY_WEBPLAYER
        if (eh.isActivate())
        {
            InputEvent ie = eh.getEventData();
            switch (ie.keycode)
            {
            //Get input from the input manager, round it to an integer and store in horizontal to set x axis move direction
            case KeyCode.RightArrow:
                if (!at_confirm)
                {
                    GameMode.instance.gamemode = GameMode.Game_Mode.CONTINUE;
                    SoundManager.instance.PlayVoice(Database.instance.MainPreContinueGame, true);
                    SceneManager.LoadScene("Main");
                }
                //SoundManager.instance.PlaySingle(swipeRight);
                break;

            case KeyCode.LeftArrow:
                if (at_confirm)
                {
                    GameMode.instance.gamemode = GameMode.Game_Mode.MAIN;
                    SoundManager.instance.PlayVoice(Database.instance.MainPreNewGame, true);
                    SceneManager.LoadScene("Main");
                }
                //SoundManager.instance.PlaySingle(swipeLeft);
                break;

            case KeyCode.E:
                if (!at_confirm)
                {
                    at_confirm  = true;
                    cur_clip    = 0;
                    reset_audio = true;
                }
                else
                {
                    at_confirm  = false;
                    cur_clip    = 0;
                    reset_audio = true;
                }
                //SoundManager.instance.PlaySingle(swipeAhead);
                break;

            default:
                break;
            }
        }

        /*
         * //Get input from the input manager, round it to an integer and store in horizontal to set x axis move direction
         * if (Input.GetKeyUp(KeyCode.RightArrow)) {
         *      if(!at_confirm){
         *              GameMode.instance.gamemode = GameMode.Game_Mode.CONTINUE;
         *              SoundManager.instance.PlayVoice(continue_game, true);
         *              SceneManager.LoadScene("Main");
         *      }
         *      //SoundManager.instance.PlaySingle(swipeRight);
         * } else if (Input.GetKeyUp(KeyCode.LeftArrow)) {
         *      if(at_confirm){
         *              GameMode.instance.gamemode = GameMode.Game_Mode.MAIN;
         *              SoundManager.instance.PlayVoice(new_game, true);
         *              SceneManager.LoadScene("Main");
         *      }
         *      //SoundManager.instance.PlaySingle(swipeLeft);
         * } else if (Input.GetKeyUp("f")) {
         *      //SceneManager.LoadScene("Main");
         *      //SoundManager.instance.PlaySingle(swipeAhead);
         * } else if (Input.GetKeyUp("e")) {
         *      if(!at_confirm){
         *              at_confirm = true;
         *              cur_clip = 0;
         *              reset_audio = true;
         *      }
         *      else{
         *              at_confirm = false;
         *              cur_clip = 0;
         *              reset_audio = true;
         *      }
         *      //SoundManager.instance.PlaySingle(swipeAhead);
         * }
         */

        //Check if we are running on iOS, Android, Windows Phone 8 or Unity iPhone
                #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        if (eh.isActivate())
        {
            InputEvent ie = eh.getEventData();

            if ((ie.touchNum == 1) && (!ie.isRotate))
            {
                if (ie.isRight)
                {
                    if (!at_confirm)
                    {
                        SoundManager.instance.PlaySingle(Database.instance.inputSFX);
                        GameMode.instance.gamemode = GameMode.Game_Mode.CONTINUE;
                        SceneManager.LoadScene("Main");
                        SoundManager.instance.PlayVoice(Database.instance.MainPreContinueGame, true);
                    }
                }
                else if (ie.isLeft)
                {
                    if (!at_confirm)
                    {
                        //nothing
                    }
                    else                      //at_confirm
                    {
                        at_confirm = false;
                        SoundManager.instance.PlaySingle(Database.instance.inputSFX);
                        GameMode.instance.gamemode = GameMode.Game_Mode.MAIN;
                        Utilities.write_save(0);
                        SceneManager.LoadScene("Main");
                        SoundManager.instance.PlayVoice(Database.instance.MainPreNewGame, true);
                    }
                }
            }
            else if ((ie.cumulativeTouchNum >= 2) && (!ie.hasDir()))
            {
                if (!at_confirm && TriggerStartNewGame.CDfinish())
                {
                    cur_clip    = 0;
                    reset_audio = true;
                    at_confirm  = true;
                    SoundManager.instance.PlaySingle(Database.instance.inputSFX);
                    TriggerStartNewGame.reset();
                }
                else if (TriggerStartNewGame.CDfinish())                  //at_confirm
                {
                    cur_clip    = 0;
                    reset_audio = true;
                    at_confirm  = false;
                    SoundManager.instance.PlaySingle(Database.instance.inputSFX);
                    TriggerStartNewGame.reset();
                }
            }
        }
                #endif //End of mobile platform dependendent compilation section started above with #elif
    }