Exemplo n.º 1
0
        public override void OnEnter()
        {
            int numberOfTweensPlayed = 0;

            switch (tweenIdType)
            {
            case Doozy.PlayMaker.Actions.TweenId.UseString: if (string.IsNullOrEmpty(stringAsId.Value) == false)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(stringAsId.Value);
                }
                break;

            case Doozy.PlayMaker.Actions.TweenId.UseTag: if (string.IsNullOrEmpty(tagAsId.Value) == false)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(tagAsId.Value);
                }
                break;

            case Doozy.PlayMaker.Actions.TweenId.UseGameObject: if (gameObjectAsId.Value != null)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(gameObjectAsId.Value);
                }
                break;
            }
            if (debugThis.Value)
            {
                State.Debug("DOTween Control Methods Play Forward By Id - Played " + numberOfTweensPlayed + " tweens");
            }
            Finish();
        }
        public override void OnEnter()
        {
            int numberOfTweensPlayed = 0;

            switch (tweenIdType)
            {
            case DOTweenActionsEnums.TweenId.UseString: if (string.IsNullOrEmpty(stringAsId.Value) == false)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(stringAsId.Value);
                }
                break;

            case DOTweenActionsEnums.TweenId.UseTag: if (string.IsNullOrEmpty(tagAsId.Value) == false)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(tagAsId.Value);
                }
                break;

            case DOTweenActionsEnums.TweenId.UseGameObject: if (gameObjectAsId.Value != null)
                {
                    numberOfTweensPlayed = DOTween.PlayForward(gameObjectAsId.Value);
                }
                break;
            }

            if (debugThis.Value)
            {
                Debug.Log("GameObject [" + State.Fsm.GameObjectName + "] FSM [" + State.Fsm.Name + "]  State [" + State.Name + "] - DOTween Control Methods Play Forward By Id - SUCCESS! - Played " + numberOfTweensPlayed + " tweens");
            }

            Finish();
        }
Exemplo n.º 3
0
        private IEnumerator StartAdding(GameObject other)
        {
            var myBricksScript = other.GetComponent <MyBricksScript>();

            GameManager.Instance.addPointText.text = "+" + myBricksScript.howMuchBricksIHave.ToString();
            DOTween.PlayForward("AddPoint");
            for (var i = 0; i < myBricksScript.howMuchBricksIHave; i++)
            {
                AddBrick();

                yield return(new WaitForSeconds(0.31f));
            }
        }
Exemplo n.º 4
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // get voodoo doll
        VooDooDoll doll = collision.transform.GetComponent <VooDooDoll>();

        if (doll)
        {
            //ScoreManager.Instance.UpdateScore(scoreAdd);
            DOTween.Rewind(gameObject);
            DOTween.PlayForward(gameObject);
            if (tears != null)
            {
                Instantiate(tears, collision.transform.position, Quaternion.identity);
            }
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(key))
        {
            //transform.DOPlay();
            //gameObject.GetComponent(DOTweenAnimation).

            DOTween.PlayForward(gameObject, "flip");
            audioData = GetComponent <AudioSource>();
            audioData.Play(0);

            print("key was pressed");
        }
        if (Input.GetKeyUp(key))
        {
            //transform.DOPlay();

            DOTween.PlayBackwards(gameObject, "flip");
            print("key was pressed");
        }
    }
Exemplo n.º 6
0
 public void OnClick()
 {
     if (!isForward)
     {
         manRectTransform.DOPlayForward();
         womanRectTransform.DOPlayForward();
         DOTween.PlayForward("sequence1");
         DOTween.PlayForward("sequence2");
         manButton.interactable   = false;
         womanButton.interactable = true;
         isForward = true;
     }
     else
     {
         manRectTransform.DOPlayBackwards();
         womanRectTransform.DOPlayBackwards();
         DOTween.PlayBackwards("sequence1");
         DOTween.PlayBackwards("sequence2");
         manButton.interactable   = true;
         womanButton.interactable = false;
         isForward = false;
     }
 }
Exemplo n.º 7
0
 public override void PlayForward()
 {
     DOTween.PlayForward(AttachedLayoutGroup);
 }
Exemplo n.º 8
0
    void OnGUI()
    {
        DGUtils.BeginGUI();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Play All"))
        {
            Debug.Log("Played tweens: " + DOTween.Play());
        }
        if (GUILayout.Button("Pause All"))
        {
            Debug.Log("Paused tweens: " + DOTween.Pause());
        }
        if (GUILayout.Button("Kill All"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill());
        }
        if (GUILayout.Button("Complete+Kill All"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill(true));
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Rewind All"))
        {
            Debug.Log("Rewinded tweens: " + DOTween.Rewind());
        }
        if (GUILayout.Button("Restart All"))
        {
            Debug.Log("Restarted tweens: " + DOTween.Restart());
        }
        if (GUILayout.Button("Complete All"))
        {
            Debug.Log("Completed tweens: " + DOTween.Complete());
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("PlayForward All"))
        {
            Debug.Log("PlayForwarded tweens: " + DOTween.PlayForward());
        }
        if (GUILayout.Button("PlayBackwards All"))
        {
            Debug.Log("PlayBackwarded tweens: " + DOTween.PlayBackwards());
        }
        if (GUILayout.Button("Flip All"))
        {
            Debug.Log("Flipped tweens: " + DOTween.Flip());
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Goto 1.5 All"))
        {
            Debug.Log("Goto-ed tweens: " + DOTween.Goto(1.5f));
        }
        if (GUILayout.Button("Goto 3 All"))
        {
            Debug.Log("Goto-ed tweens: " + DOTween.Goto(3));
        }
        if (GUILayout.Button("Goto 4.5 All"))
        {
            Debug.Log("Goto-ed tweens: " + DOTween.Goto(4.5f));
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Play by Id"))
        {
            Debug.Log("Played tweens: " + DOTween.Play(intId));
        }
        if (GUILayout.Button("Play by StringId"))
        {
            Debug.Log("Played tweens: " + DOTween.Play(stringId));
        }
        if (GUILayout.Button("Play by UnityObjectId"))
        {
            Debug.Log("Played tweens: " + DOTween.Play(this));
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Pause by Id"))
        {
            Debug.Log("Paused tweens: " + DOTween.Pause(intId));
        }
        if (GUILayout.Button("Pause by StringId"))
        {
            Debug.Log("Paused tweens: " + DOTween.Pause(stringId));
        }
        if (GUILayout.Button("Pause by UnityObjectId"))
        {
            Debug.Log("PlaPausedyed tweens: " + DOTween.Pause(this));
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Kill by Id"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill(intId));
        }
        if (GUILayout.Button("Complete+Kill by Id"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill(intId, true));
        }
        if (GUILayout.Button("Kill by StringId"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill(stringId));
        }
        if (GUILayout.Button("Kill by UnityObjectId"))
        {
            Debug.Log("Killed tweens: " + DOTween.Kill(this));
        }
        if (GUILayout.Button("Clear"))
        {
            Debug.Log(":::::::::::: CLEAR");
            DOTween.Clear();
        }
        if (GUILayout.Button("Clear & Reload"))
        {
            Debug.Log(":::::::::::: CLEAR AND RELOAD");
            int level = Application.loadedLevel;
            DOTween.Clear();
            Application.LoadLevel(level);
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        foreach (Tween t in tweens)
        {
            if (GUILayout.Button("Direct Kill"))
            {
                t.Kill();
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(5);

        GUILayout.Label("Global DOTween Timescale");
        GUILayout.BeginHorizontal();
        DOTween.timeScale = GUILayout.HorizontalSlider(DOTween.timeScale, 0.0f, 20.0f);
        if (GUILayout.Button("Reset", GUILayout.Width(80)))
        {
            DOTween.timeScale = 1;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        for (int i = 0; i < tweens.Length; ++i)
        {
            GUILayout.Label("Single Timescale");
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        foreach (Tween t in tweens)
        {
            t.timeScale = GUILayout.HorizontalSlider(t.timeScale, 0.0f, 20.0f, GUILayout.Width(60));
            if (GUILayout.Button("Reset", GUILayout.Width(80)))
            {
                t.timeScale = 1;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        foreach (Tween t in tweens)
        {
            GUILayout.Label("Elapsed: " + t.Elapsed(false) +
                            "\nFullElapsed: " + t.Elapsed() +
                            "\nElapsed %: " + t.ElapsedPercentage(false) +
                            "\nFullElapsed %: " + t.ElapsedPercentage() +
                            "\nCompleted Loops: " + t.CompletedLoops()
                            );
        }
        GUILayout.EndHorizontal();

        DGUtils.EndGUI();
    }
Exemplo n.º 9
0
 public static int DOPlayForward(this Material target)
 {
     return(DOTween.PlayForward(target));
 }
Exemplo n.º 10
0
 public static int DOPlayForward(this Component target)
 {
     return(DOTween.PlayForward(target));
 }
Exemplo n.º 11
0
    // Матрицф кнопок изменилась => пользователь что-то переключил, действуем.
    void buttonMatrixChanged(int index, char value)
    {
        bool b = value == '0';

        //windowGrid
        if (index == 4)           // охлаждение
        {
            windowGrid.windowsEnabled [5] = b;
            CircularSineWaveVis.enabled   = b;
            graphDisplay.enabled          = b;
        }
        else if (index == 5)             // Спутник
        {
            windowGrid.windowsEnabled [4] = b;
        }
        else if (index == 7)             // Спутник
        {
            windowGrid.windowsEnabled [3] = b;
        }
        else if (index == 13)             // Спутник
        {
            windowGrid.windowsEnabled [2] = b;
            archive.isOn = b;
        }
        else if (index == 33 && b)
        {
            //print ("Unable to stop the enslavement of the world once it's started!");
            messageBoxController.showMessageBox("Error", "Unable to stop the enslavement of the world once it's started!  \n \n Невозможно остановить порабощение после его запуска!", 8f);
        }
        else if (index == 32 && !b)
        {
            //print ("Unable to stop the enslavement of the world once it's started!");
            messageBoxController.showMessageBox("WARNING!", "Hacking world's nuclear missiles, nuclear apocalypse in 60 minutes!  \n \n Взлом ядерных боеголовок, атомная война через 60 минут!", 8f);
        }
        else if (index == 24 && !b)
        {
            //print ("Unable to stop the enslavement of the world once it's started!");
            messageBoxController.showMessageBox("WARNING!", "You don't wanna know what that does, but you are dead anyways... \n \n Вам лучше не знать что вы только что запустили, но жить вам осталось не долго...", 8f);
        }
        else if (index == 11 && !b)
        {
            powerPanel.core_1_inc();
        }
        else if (index == 10 && !b)
        {
            powerPanel.core_1_dec();
        }
        else if (index == 19 && !b)
        {
            powerPanel.core_2_inc();
        }
        else if (index == 18 && !b)
        {
            powerPanel.core_2_dec();
        }
        else if (index == 9)
        {
            if (powerPanel.ionsPurged)
            {
                messageBoxController.showMessageBox("ERROR!", "Can not start CORE 1! No ions detected! \n \n Не возможно запустить ЯДРО 1 при сброшенных ионах!", 8f);
            }
            else
            {
                powerPanel.cores [0].isOn = !b;
            }
        }
        else if (index == 8)
        {
            if (powerPanel.ionBlock && !b)
            {
                messageBoxController.showMessageBox("ERROR!", "Can not start CORE 2! Ion block detected! \n \n Не возможно запустить ЯДРО 2! Обнаружен блок ионов!", 8f);
            }
            else if (powerPanel.ionsPurged)
            {
                messageBoxController.showMessageBox("ERROR!", "Can not start CORE 2! No ions detected! \n \n Не возможно запустить ЯДРО 2 при сброшенных ионах!", 8f);
            }
            else
            {
                powerPanel.cores [1].isOn = !b;
            }
        }
        else if (index == 3 && !b)
        {
            if (powerPanel.ionsPurged)
            {
                messageBoxController.showMessageBox("NOTE", "Need to refill ions first. \n \n Перед увеличением скорости, нужно заменить ионы.", 8f);
            }
            else
            {
                powerPanel.ionSpeed_inc();
            }
        }
        else if (index == 2 && !b)
        {
            powerPanel.ionSpeed_dec();
        }
        else if (index == 1 && !b)             //Сброс
        {
            if (!powerPanel.ionBlock)
            {
                messageBoxController.showMessageBox("NOTE", "No Ion Errors detected, Ion purge not needed. \n \n Не обнаружены ошибки ионов, сброс не требуется.", 8f);
            }
            else
            {
                powerPanel.ionPurge();
                //powerPanel.cores [0].isOn = false;
                //powerPanel.cores [1].isOn = false;
            }
        }
        else if (index == 0 && !b)             //Замена
        {
            if (powerPanel.ionsPurged)
            {
                powerPanel.ionRefill();
            }
            else
            {
                messageBoxController.showMessageBox("NOTE", "Need to purge active ions first. \n \n Перед заменой требуется сбросить активные.", 8f);
            }
        }
        else if (index == 6)             // Спутник
        {
            if (b)
            {
                DOTween.PlayBackwards("CommWindowHide");
            }
            else
            {
                DOTween.PlayForward("CommWindowHide");
            }
        }
        else if (index == 12)             // Спутник
        {
            if (b)
            {
                displayDemographics = true;
                DOTween.PlayBackwards("DemographicsHide");
            }
            else
            {
                displayDemographics = false;
                DOTween.PlayForward("DemographicsHide");
            }
        }
        else if (index == 39)             // Синхр маг полей вкл
        {
            Sync.SetActive(b);
            X.SetActive(b && syncX);
            Y.SetActive(b && syncY);
            SyncEnabled = b;
        }
        else if (index == 38)             //X
        {
            X.SetActive(b && SyncEnabled);
            syncX = b;
        }
        else if (index == 37)             //Y
        {
            Y.SetActive(b && SyncEnabled);
            syncY = b;
        }
        else if (index == 36)             //PK
        {
            PK.SetActive(b);
            PK_Enabled = b;
        }
        else if (index == 35)             //BSM
        {
            BSM.SetActive(b);
            BSM_Enabled = b;
        }
        else if (index == 34)             //AZ
        {
            AZ.SetActive(b);
            AZ_Enabled = b;
        }
        else if (index == 26)             //Reserve CH
        {
            b = !b;
            Reserve_Enabled = b;
            GSM.SetActive(b && GSM_Enabled);
            LTE.SetActive(b && LTE_Enabled);
            Wifi.SetActive(b && Wifi_Enabled);
            Antenna.SetActive(b && Antenna_Enabled);
            Dish.SetActive(b && Dish_Enabled);
        }
        else if (index == 28)             //GSM
        {
            GSM.SetActive(b && Reserve_Enabled);
            GSM_Enabled = b;
        }
        else if (index == 29)             //LTE
        {
            LTE.SetActive(b && Reserve_Enabled);
            LTE_Enabled = b;
        }
        else if (index == 30)             //Wifi
        {
            Wifi.SetActive(b && Reserve_Enabled);
            Wifi_Enabled = b;
        }
        else if (index == 31)             //Antenna-Radio
        {
            Antenna.SetActive(b && Reserve_Enabled);
            Antenna_Enabled = b;
        }
        else if (index == 27)             //Dish(sat)
        {
            Dish.SetActive(b && Reserve_Enabled);
            Dish_Enabled = b;
        }
        else if (index == 16)
        {
            commsDisable = !b;
        }
        else if (index == 17)
        {
            firewall = !b;
        }
    }
Exemplo n.º 12
0
    void UpdateSerial()
    {
        //return;
        //int data=0;
        for (int j = 0; j < 5; j++)
        {
            string tempString = serialClass.ReadFromArduino();
            //print (tempString);
            //GameObject.Find ("debugText").GetComponent<Text> ().text = tempString;
            string[] stringArray;


            if (tempString != null)
            {
                if (tempString.StartsWith("S"))                    //Start quest
                {
                    timerController.paused = false;
                    timerController.setStartTime();
                }
                else if (tempString.StartsWith("k") && tempString.Length >= transmittedCharsNumber)                      //key
                {
                    if (tempString.StartsWith("k--"))
                    {
                        for (int i = 0; i < keyStates.Length; i++)
                        {
                            keyStates [i] = false;
                        }
                        unlockObject.reset();
                    }
                    else
                    {
                        //print (tempString);
                        //data = (int)tempString[1] + 256*(int)tempString[2];
                        tempString = hexToBin(tempString.Substring(1));
                        //tempString = Convert.ToString(data, 2);
                        //print (tempString);
                        for (int i = 0; i < charsNumber; i++)
                        {
                            if (tempString.Length > i)
                            {
                                keyStates [i] = (tempString [tempString.Length - 1 - i] == '1' ? true : false);
                            }
                            else
                            {
                                keyStates [i] = false;
                            }
                        }
                    }
                }
                else if (tempString.StartsWith("s"))                      //sound

                //AudioController.Play(audioIDs[int.Parse(tempString.Substring(1), System.Globalization.NumberStyles.HexNumber)]);
                {
                }
                else if (tempString.StartsWith("m"))                      //show slave monitor
                {
                    print("--------------------- SLAVE ON");
                    GameObject.Find("Camera-Slices").GetComponent <Camera> ().enabled = true;
                }
                else if (tempString.StartsWith("M"))                      //show MAIN monitor
                {
                    print("--------------------- SLAVE OFF");
                    GameObject.Find("Camera-Slices").GetComponent <Camera> ().enabled = false;
                }
                else if (tempString.StartsWith("U"))                 // USB connected
                {
                    if (tempString [1] == '1')                       // FIRST USB
                    {
                        usbDriveConnected = true;
                    }
                    else
                    {
                    }
                }
                else if (tempString.StartsWith("u"))                 // USB DISconnected
                {
                    if (tempString [1] == '1')                       // FIRST USB
                    {
                        usbDriveConnected = false;
                    }
                    else
                    {
                    }
                }
                else if (tempString.StartsWith("o"))                      // "OTHER" - ONE CHAR COMMANDS
                //for(int i=1;i<tempString.Length;i++){
                {
                    if (tempString [1] == 'D')                       // Door opened

                    {
                        doorOpen = true;
                        GameObject.Find("Camera-Slices").GetComponent <Camera> ().enabled = false;
                    }
                    else if (tempString [1] == 'C')                         // Battery charged
                    {
                        batteryCharged = true;
                    }
                    else if (tempString [1] == 'c')                         // Battery DIScharged
                    {
                        batteryCharged = false;
                    }
                    else if (tempString [1] == 'B')                         // Battery installed
                    {
                        batteryInstalled = true;
                    }
                    else if (tempString [1] == 'b')                         // Battery UNinstalled
                    {
                        batteryInstalled = false;
                    }
                    //}
                }
                else if (tempString.StartsWith("J"))                      // JOYSTICK UPDATE

                {
                    if (state >= STATE_SATELLITE_LOCKED)
                    {
                        SerialComm.WriteToArduino("#S");                          //SATELLITE LOCKED COMMAND
                    }

                    joystickX = (hexToDec(tempString.Substring(1, 1)) - 7) / 7f;
                    joystickY = (hexToDec(tempString.Substring(2, 1)) - 7) / 7f;

                    //joystickX = ((int)Char.GetNumericValue (tempString [1]) - 4)/4f;
                    //joystickY = ((int)Char.GetNumericValue (tempString [2]) - 4)/4f;
                }
                else if (tempString.StartsWith("E"))                      // ENCODER UPDATE

                {
                    encoderPosition = int.Parse(tempString.Substring(1));
                }
                else if (tempString.StartsWith("P"))
                {
                    stringArray = tempString.Substring(1).Split('P');

                    if (stringArray.Length >= 5)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            potReadings [i, currentReadingIndex] = int.Parse(stringArray [i]);

                            if (potRotators [i] != null)
                            {
                                potRotators [i].value = potReadings [i, currentReadingIndex];
                            }
                        }
                        currentReadingIndex = (currentReadingIndex + 1) % samples;
                    }
                }
                else if (tempString.StartsWith(">"))
                {
                    tempString = longHexToBin(tempString.Substring(1));

                    while (tempString.Length < 40)
                    {
                        tempString += '0';
                    }


                    if (buttonsData.Length != tempString.Length)
                    {
                        buttonsData = tempString;
                    }
                    else
                    {
                        for (int i = 0; i < tempString.Length; i++)
                        {
                            if (buttonsData [i] != tempString [i] || !buttonDataInitialized)
                            {
                                buttonMatrixChanged(i, tempString [i]);
                                print("Different Index = " + i);
                            }
                        }
                    }

                    buttonsData           = tempString;
                    buttonDataInitialized = true;
                }
                else if (tempString.StartsWith("R"))
                {
                    regionSelect = int.Parse(tempString.Substring(1, 1));
                    iqSelect     = int.Parse(tempString.Substring(2, 1));
                    ageSelect    = int.Parse(tempString.Substring(3, 1));
                }
                else if (tempString.StartsWith("F"))
                {
                    if (tempString [1] == '1')
                    {
                        DOTween.PlayBackwards("flash_hide");
                        black_2.SetActive(false);
                    }
                    else
                    {
                        DOTween.PlayForward("flash_hide");
                        black_2.SetActive(true);
                    }
                }

                if (tempString.StartsWith("<"))
                {
                    Application.LoadLevel(Application.loadedLevel);
                }



                if (tempString.StartsWith("f"))                    // 6 PUZZLE FRAGMENTS
                {
                    print("--------------------- " + tempString);


                    textureChangeObject.GetComponent <TextureChange> ().changeTexture((int)Char.GetNumericValue(tempString [1]) - 1, (int)Char.GetNumericValue(tempString [2]));
                }
            }
            else                 //NOHING to read
            {
                break;
            }
        }
    }
Exemplo n.º 13
0
    void Update()
    {
        UpdateSerial();

        if (state >= STATE_SATELLITE_LOCKED)
        {
            updatePotReadings();
            updatePotVisuals();
            updateSelection();
            calculateReactorLoad();
            calculateCooling();
        }

        //test

        /*if(Input.GetKeyUp(KeyCode.R)){
         *      Application.LoadLevel(Application.loadedLevel);
         * }*/

        if (state == STATE_COUNTDOWN)
        {
            if (doorOpen)
            {
                showLowBattery();
                state = STATE_LOWBATTERY;
            }
        }
        else if (state == STATE_LOWBATTERY)
        {
            if (!batteryInstalled)
            {
                fadeToBlack();
                state = STATE_NOBATTERY;
            }
        }
        else if (state == STATE_NOBATTERY)
        {
            if (batteryInstalled)
            {
                fadeFromBlack();
                if (!batteryCharged)
                {
                    state = STATE_LOWBATTERY;
                }
                else
                {
                    state = STATE_UNLOCK_SCREEN;
                    unlockPanel.SetActive(true);

                    //unlockPanel.transform.Translate(0f, -500f,0f);
                    //unlockPanel.GetComponent<videoAnim> ().enabled = true;
                    unlockPanel.GetComponent <DOTweenAnimation> ().DOPlayBackwards();
                    //unlockPanel.GetComponent<videoAnim>().start();
                    StartCoroutine("PlayUnlockInitAnimation", 1f);

                    lowBatteryIcon.SetActive(false);
                    //GameObject.Find ("LowBatteryIcon").GetComponent<DOTweenAnimation> ().DOPlayBackwards ();
                }
            }
        }
        else if (state == STATE_UNLOCK_SCREEN)
        {
            unlockObject.updateButtons(keyStates);
            if (!standaloneDebug)
            {
                codeEnteredCorrect = unlockObject.checkComplete();
            }
            if (codeEnteredCorrect)
            {
                //unlockPanel.SetActive(true);
                SerialComm.WriteToArduino("#C");                  //CODE CORRECT COMMAND

                unlockPanel.GetComponent <DOTweenAnimation> ().DOPlayForward();
                StartCoroutine("DisableUnlockPanel", 1f);
                state = STATE_SATELLITE_DISCONNECTED_SCREEN;
                //StartCoroutine("delayedShowMessageBox",1f);
                DOTween.PlayBackwards("SatelliteSearchTextFade");

                StartCoroutine("delayedShowRadar", 2f);
                //satellite.transform.localScale = new Vector3(0,0,0);
                satellite.GetComponent <DOTweenAnimation> ().DOPlayBackwards();
            }
        }
        else if (state == STATE_SATELLITE_DISCONNECTED_SCREEN)
        {
            if (standaloneDebug)
            {
                joystickX = Input.GetKey(KeyCode.RightArrow).GetHashCode() + Input.GetKey(KeyCode.LeftArrow).GetHashCode() * -1;
                joystickY = Input.GetKey(KeyCode.UpArrow).GetHashCode() + Input.GetKey(KeyCode.DownArrow).GetHashCode() * -1;
            }

            radarController.velocity.x = joystickX * 10;            //+= (joystickX*10-radarController.velocity.x)*0.9f;
            radarController.velocity.y = joystickY * 10;


            if (radarController.progress > 0.7f && radarController.progress < 0.95f)
            {
                Vector3 tempVec = satellite.transform.localScale;
                tempVec.x = tempVec.y = tempVec.z = (radarController.progress - 0.7f) / 0.3f * satelliteInitialScale;
                satellite.transform.localScale = tempVec;
            }
            else if (radarController.progress > 0.95f)
            {
                state = STATE_SATELLITE_LOCKED;
                SerialComm.WriteToArduino("#S");                  //SATELLITE LOCKED COMMAND
                radarController.locked         = true;
                satellite.transform.localScale = new Vector3(satelliteInitialScale, satelliteInitialScale, satelliteInitialScale);
                //satellite.GetComponent<DOTweenAnimation>().DOPlayForward();
                //DOTween.PlayForward ("satelliteShow");
                DOTween.PlayForward("SatelliteSearchTextFade");
                if (!windowGrid.enabled)
                {
                    windowGrid.enabled = true;
                }
            }
        }
        else if (state == STATE_SATELLITE_LOCKED)
        {
            if (usbDriveConnected)
            {
                state = STATE_HACKING;
                hackWindow.SetActive(true);
                progressBar.SetActive(true);
                DOTween.PlayBackwards("progressBarHide");
                DOTween.PlayBackwards("hackWindowHide");
                progressBarController.setTitle("Hacking satellite...", "Взлом спутника...");
            }
        }
        else if (state == STATE_HACKING)
        {
            if (progressBarController.progress < 0.32)
            {
                progressBarController.progress += UnityEngine.Random.value * 0.005f;
            }
            else if (progressBarController.progress < 1)
            {
                if (!satSerialOk && !inputBox.activeSelf)
                {
                    inputBox.SetActive(true);
                    inputBox.GetComponent <DOTweenAnimation> ().DOPlayBackwards();
                    inputController.createInputBox("Input satellite serial #");
                    //StartCoroutine("delayedShowMessageBox",1f);
                }


                if (satSerialOk)
                {
                    progressBarController.progress += UnityEngine.Random.value * 0.005f;
                }
                else
                {
                    if (inputController.inputString.Length == satSerial.Length)
                    {
                        if (inputController.inputString == satSerial)
                        {
                            satSerialOk = true;
                            //remove inputbox
                            inputBox.GetComponent <DOTweenAnimation> ().DOPlayForward();
                            StartCoroutine("delayedDisableInputBox", 1f);
                        }
                        else
                        {
                            //replace title with "try again" and clear input field
                            inputController.changeTitle("Try again", true);
                            inputController.clear();
                        }
                    }
                }
            }
            else
            {
                timerController.paused = true;

                //AudioController.Play("SatelliteRollback");

                //Перекрасить спутник в красный
                foreach (Transform child in satellite.transform)
                {
                    child.gameObject.GetComponent <Renderer> ().material = satelliteRed;
                }
                state = STATE_HACKED;
                StartCoroutine("delayedStartSatReboot");
                DOTween.PlayForward("progressBarHide");
                DOTween.PlayForward("hackWindowHide");
                progressBarController.progress = 0;
                GameObject.Find("HackingVideo").GetComponent <videoAnim> ().pause();
                //TEST OVERHEAT FROM FLASH DRIVE
                if (!overheatSent)
                {
                    SerialComm.WriteToArduino("#E");
                    mainCamera.GetComponent <CameraFilterPack_FX_Glitch1> ().enabled     = true;
                    mainCamera.GetComponent <CameraFilterPack_TV_BrokenGlass> ().enabled = true;
                    overheatSent = true;
                }
            }
        }
        else if (state == STATE_HACKED)
        {
            progressBarController.progress = 1 - timerController.timeLeft() / timeStamp;
        }
    }