Example #1
0
    // Update is called once per frame
    void Update()
    {
        //Read Input from keyboard
        if (Input.GetKeyDown(interaction.keyCode))
        {
            interaction.value = !interaction.value;
        }

        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;
        }

        if (interaction.value)
        {
            animator.SetInteger("AnimState", 1);
            interaction.counter += Time.deltaTime;
            if (interaction.counter > interaction.timeOut)
            {
                interaction.value   = !interaction.value;
                interaction.counter = 0;
            }
        }
        else
        {
            animator.SetInteger("AnimState", 0);
        }
    }
Example #2
0
 void ReadInput()
 {
     //interaction.value = (Input.GetKeyDown(interaction.keyCode));
     //|| (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1));
     if ((Input.GetKeyDown(interaction.keyCode)) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
     {
         interaction.value = true;
     }
 }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(interaction.keyCode))
        {
            interaction.value = !interaction.value;
        }
        if (Input.GetKeyDown(interaction.keyCode2))
        {
            interaction.value2 = !interaction.value2;
        }

        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;
        }
        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
        {
            interaction.value2 = !interaction.value2;
        }


        if (state == 0)
        {
            if (interaction.value)
            {
                animator.SetTrigger("state1");
                state = 1;
                interaction.value2 = false;
                interaction.value  = false;
            }
        }

        else if (state == 1)
        {
            if (interaction.value2)
            {
                animator.SetTrigger("state2");
                state = 2;
                interaction.value2  = false;
                interaction.value   = false;
                interaction.counter = 0;
            }

            TimerCount();
        }

        else if (state == 2)
        {
            TimerCount();
        }
    }
Example #4
0
    void ReadInput()
    {
        if (Input.GetKey(interaction.keyCode) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;


            //Debug.Log("masuk 1");
        }
        if (Input.GetKey(interaction.keyCode2) || SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
        {
            interaction.value2 = !interaction.value2;


            //Debug.Log("masuk 2");
        }
    }
Example #5
0
 // Update is called once per frame
 void Update()
 {
     /*if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
      * {
      *  source.PlayOneShot(audio1,volume1);
      *  float fadeTime = fading.BeginFade(1);
      *  //yield return new WaitForSeconds(fadeTime);
      *  SceneManager.LoadScene(scene);
      *  //source.PlayOneShot(audio2, volume2);
      * }*/
     if (Input.GetKeyDown(key) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
     {
         source.PlayOneShot(audio1, volume1);
         float fadeTime = fading.BeginFade(1);
         //yield return new WaitForSeconds(fadeTime);
         SceneManager.LoadScene(scene);
         source.PlayOneShot(audio2, volume2);
     }
 }
Example #6
0
    void ReadInput()
    {
        if (Input.GetKey(interaction.keyCode) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;
        }
        if (Input.GetKey(interaction.keyCode2) || SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
        {
            interaction.value2 = !interaction.value2;
        }

        /*
         * if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
         * {
         *  interaction.value = !interaction.value;
         * }
         * if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
         * {
         *  interaction.value2 = !interaction.value2;
         * }*/
    }
Example #7
0
    void ReadInput()
    {
        if (Input.GetKey(interaction.keyCode) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("STORE_idle"))
            {
                store.PlayHide();
                tangan.SetActive(false);
                PlaySound();
                timer = true;
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("STORE_showing"))
            {
                store.PlayIdle();
                //tangan.SetActive(false);
                soundState = false;
            }
        }

        /*
         * if (SerialHandler.serial_is_open && )
         * {
         * if (animator.GetCurrentAnimatorStateInfo(0).IsName("STORE_idle"))
         * {
         * store.PlayHide();
         * tangan.SetActive(false);
         * PlaySound();
         * timer = true;
         * }
         * else if (animator.GetCurrentAnimatorStateInfo(0).IsName("STORE_showing"))
         * {
         * store.PlayIdle();
         * //tangan.SetActive(false);
         * soundState = false;
         * }
         * }*/
    }
Example #8
0
        void Update()
        {
            if (SerialHandler.getSensorDown((int)TouchSensor.PrologSub) || Input.GetKey(KeyCode.Q))
            {
                OnSensorTap(0);
                if (audiostate1 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate1 = true;
                }
            }
            else
            {
                audiostate1 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.RumahKanan) || Input.GetKey(KeyCode.W))
            {
                OnSensorTap(1);
                if (audiostate2 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate2 = true;
                }
            }
            else
            {
                audiostate2 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Factory) || Input.GetKey(KeyCode.E))
            {
                OnSensorTap(2);
                if (audiostate3 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate3 = true;
                }
            }
            else
            {
                audiostate3 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Prolog) || Input.GetKey(KeyCode.R))
            {
                OnSensorTap(3);
                if (audiostate4 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate4 = true;
                }
            }
            else
            {
                audiostate4 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.FarmBawah) || Input.GetKey(KeyCode.T))
            {
                OnSensorTap(4);
                if (audiostate5 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate5 = true;
                }
            }
            else
            {
                audiostate5 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Player1Kanan) || Input.GetKey(KeyCode.Y))
            {
                OnSensorTap(5);
                if (audiostate6 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate6 = true;
                }
            }
            else
            {
                audiostate6 = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Store) || Input.GetKey(KeyCode.U))
            {
                OnSensorTap(6);
                if (audiostate7 == false)
                {
                    source.PlayOneShot(audio1);
                    audiostate7 = true;
                }
            }

            else
            {
                audiostate7 = false;
            }


            if (isStart && !isGameOver)
            {
                timer -= Time.deltaTime;
                if (timer < 0)
                {
                    timer = 0;
                    Gameover(false);
                }
                int timeInINteger = (int)timer;
                timerText.text = timeInINteger.ToString();
                //print("s");
            }
        }
Example #9
0
    void ReadInput()
    {
        if (Input.GetKey(interaction.keyCode) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_idle"))
            {
                pabrik.DoHide = true;
                PlaySound();
                tap.SetActive(false);
                timer = true;
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_showing"))
            {
                pabrik.DoIdle = true;
                temp          = 0;

                soundState = false;
                stateTemp  = false;
                stateBell  = false;
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_state2_part3_show"))
            {
                if (temp < 1)
                {
                    temp += Time.deltaTime / 4f;
                    pabrik.SetHotThermometerValue(temp);
                    stopwatchCount = (int)(temp * 4);
                    button.GetComponent <Animator> ().SetInteger("AnimState", 1);
                    pabrik.StopwatchController.SetValue((4 - stopwatchCount), 4, (1 - temp));
                    if (stateTemp == false)
                    {
                        audio3.Play();
                        stateTemp = true;
                    }
                }
            }
        }
        else
        {
            audio3.Stop();
            button.GetComponent <Animator> ().SetInteger("AnimState", 0);
            stateTemp = false;
        }

        /*
         * else if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
         * {
         *  if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_idle"))
         *  {
         *      pabrik.DoHide = true;
         *      tap.SetActive(false);
         *      PlaySound();
         *      timer = true;
         *  }
         *  else if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_showing"))
         *  {
         *      pabrik.DoIdle = true;
         *      temp = 0;
         *
         *      soundState = false;
         *
         *  }
         *  else if (animator.GetCurrentAnimatorStateInfo(0).IsName("PABRIK_state2_part3_show"))
         *  {
         *      if (temp < 1)
         *      {
         *          temp += Time.deltaTime / 4f;
         *          pabrik.SetHotThermometerValue(temp);
         *      }
         *  }
         *
         * }
         */
        /*
         * else if (Input.GetKey(interaction.keyCode) == false && (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1) == false))
         * {
         *
         *  if (temp < 1)
         *  {
         *      if (temp >= 0)
         *      {
         *          temp -= Time.deltaTime/4f;
         *      }
         *      pabrik.SetHotThermometerValue(temp);
         *  }
         *
         *
         * }*/
    }
Example #10
0
    private void Update()
    {
        if (responseTimer1 > responseTime1)
        {
            if (SerialHandler.getSensorDown((int)TouchSensor.Player1Kiri) || Input.GetKey(KeyCode.A))
            {
                responseTimer1 = 0f;
                ControllerPressed(0);
                mimiControllers[0].color = colorBtnPressed;
                if (audio1Kiri == false)
                {
                    source.PlayOneShot(clipPlayer1);
                    audio1Kiri = true;
                }
            }

            else
            {
                mimiControllers[0].color = colorBtnNormal;
                audio1Kiri = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Player1Kanan) || Input.GetKey(KeyCode.D))
            {
                responseTimer1 = 0f;
                ControllerPressed(1);
                mimiControllers[1].color = colorBtnPressed;
                if (audio1Kanan == false)
                {
                    source.PlayOneShot(clipPlayer1);
                    audio1Kanan = true;
                }
            }
            else
            {
                mimiControllers[1].color = colorBtnNormal;
                audio1Kanan = false;
            }
        }
        else
        {
            responseTimer1 += Time.deltaTime;
        }

        if (responseTimer2 > responseTime2)
        {
            if (SerialHandler.getSensorDown((int)TouchSensor.Player2Kiri) || Input.GetKey(KeyCode.LeftArrow))
            {
                responseTimer2 = 0f;
                ControllerPressed(2);
                leonControllers[0].color = colorBtnPressed;
                if (audio2Kiri == false)
                {
                    source.PlayOneShot(clipPlayer1);
                    audio2Kiri = true;
                }
            }
            else
            {
                leonControllers[0].color = colorBtnNormal;
                audio2Kiri = false;
            }

            if (SerialHandler.getSensorDown((int)TouchSensor.Player2Kanan) || Input.GetKey(KeyCode.RightArrow))
            {
                responseTimer2 = 0f;
                ControllerPressed(3);
                leonControllers[1].color = colorBtnPressed;
                if (audio2Kanan == false)
                {
                    source.PlayOneShot(clipPlayer1);
                    audio2Kanan = true;
                }
            }
            else
            {
                leonControllers[1].color = colorBtnNormal;
                audio2Kanan = false;
            }
        }
        else
        {
            responseTimer2 += Time.deltaTime;
        }
    }