Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (LeapService.IsConected())
     {
         if (leap_panel.activeSelf)
         {
             leap_panel.SetActive(false);
             Time.timeScale = 1;
         }
     }
     else if (!leap_panel.activeSelf)
     {
         leap_panel.SetActive(true);
         Time.timeScale = 0;
     }
 }
Exemplo n.º 2
0
        // Update is called once per frame
        void Update()
        {
            if (LeapService.IsConected() | withKeyboard)
            {
                if (leapPanel.activeSelf)
                {
                    leapPanel.SetActive(false);
                    Time.timeScale = 1;
                }

                switch (gameState)
                {
                case GameState.PLAYING:
                {
                    if (withTime)
                    {
                        currentTime -= Time.deltaTime;

                        if (currentTime >= 0)
                        {
                            timeMillis -= Time.deltaTime * 1000f;
                            if (timeMillis < 0)
                            {
                                timeMillis = 1000f;
                            }
                            currentTimeText.text = (((int)currentTime) / 60).ToString("00") + ":"
                                                   + (((int)currentTime) % 60).ToString("00") + ":"
                                                   + ((int)(timeMillis * 60 / 1000)).ToString("00");
                            sliderCurrentTime.value = currentTime * 100 / totalTime;
                        }
                        else
                        {
                            gameState            = GameState.GAMEOVER;
                            currentTimeText.text = "00:00:00";
                            //state = PlayState.NONE;
                        }
                    }
                    else
                    {
                        totalTime += Time.deltaTime;
                    }
                }
                break;

                case GameState.GAMEOVER:
                {
                    gameState = GameState.END;
                    EndGame();
                }
                break;

                case GameState.STARTING:
                {
                    if (!parametersPanel.activeSelf)
                    {
                        parametersPanel.SetActive(true);
                    }
                }
                break;

                default:
                {
                }
                break;
                }
            }
            else if (!leapPanel.activeSelf)
            {
                leapPanel.SetActive(true);
                Time.timeScale = 0;
            }
        }
Exemplo n.º 3
0
 private void OnApplicationQuit()
 {
     LeapService.DestroyController();
 }
Exemplo n.º 4
0
 private void OnDestroy()
 {
     LeapService.DestroyController();
 }
Exemplo n.º 5
0
 void Start()
 {
     //new LeapService().CreateService();
     LeapService.CreateController();
 }
Exemplo n.º 6
0
 // Use this for initialization
 void Awake()
 {
     LeapService.CreateController();
 }