Example #1
0
        public void UpdateState()
        {
            if (waitForLeave)
            {
                if (!GameManager.Instance.GarageIsClosing)
                {
                    manager.SwitchState(GameStateManager.GameState.PUFFERFISH);
                }
                return;
            }

            if (manager.PadKeyUp)
            {
                garageController.LiftMachineStop();
            }

            if (manager.PadPressL)
            {
                garageController.GarageTurnLeft();
            }
            else if (manager.PadPressR)
            {
                garageController.GarageTurnRight();
            }

            if (manager.PadPressUpward)
            {
                garageController.LiftMachineRaiseUp();
            }
            else if (manager.PadPressDownward)
            {
                garageController.LiftMachineFallDown();
            }

            if (manager.PadPressCenter && manager.PadIsFirstPress)
            {
                bool isopen = garageController.GarageSwitch();
                if (isopen && !GameManager.Instance.GarageIsClosing)
                {
                    if (!isOpenGate)
                    {
                        Debug.Log("StartGarageSetting");
                        GameManager.Instance.StartGarageSetting();
                        isOpenGate = true;
                    }
                }
                else
                {
                    isOpenGate = false;
                    GameManager.Instance.CloseGarageSetting();
                }
            }

            if (GameManager.Instance.ViveIsGrip() && !waitForLeave)
            {
                garageController.GarageClose();
                waitForLeave = true;
                GameManager.Instance.CloseGarageSetting();
            }
        }
Example #2
0
 public void UpdateState()
 {
     if (GameManager.Instance.ViveIsGrip() &&
         GameManager.Instance.IsFishIdle() //fish idle, player can 'grip' to switch game, otherwise 'grip' is pick up gun.
                                           //the pick up gun behaviour is handle by ViveInputUtility.
         )
     {
         manager.SwitchState(GameStateManager.GameState.ROBOT);
     }
     else if (ViveInput.GetPressDown(HandRole.RightHand, ControllerButton.Trigger))
     {
         if (GameManager.Instance.IsFishIdle())
         {
             GameManager.Instance.FairyStick.gameObject.SetActive(!GameManager.Instance.FairyStick.gameObject.activeSelf);
         }
     }
 }
        public void UpdateState()
        {
            //1: select [scan] | [load] ,2:[saving], 3:[loading], 0: select wall done, 4: [scanning], 5: [Select wall]
            if (scanningProgress == 0)
            {
                return;
            }

            bool padpress     = ViveInput.GetPressDown(HandRole.RightHand, ControllerButton.Pad);
            bool triggerpress = ViveInput.GetPressDown(HandRole.RightHand, ControllerButton.Trigger);

            if (scanningProgress == 1)//select [scan] | [load]
            {
                GameManager.Instance.EnableInfoText(true);

                if (triggerpress)
                {
                    SRWorkControl.Instance.SetScanning(true);
                    scanningProgress = 4;
                }
                else if (padpress ||
                         Input.GetKeyUp(KeyCode.A)
                         )
                {
                    if (StartLoadReconstructData())
                    {
                        scanningProgress = 3;
                    }
                    else
                    {
                        GameManager.Instance.ShowInfoTextAni("<line-height=150%><b><size=120%>None scanned data!\n<line-height=80%><size=100%>Press <color=#FFC000FF>Trigger</b>\n<color=white><size=80%>to start scanning room");
                    }
                }
            }
            else if (scanningProgress == 2)//[saving]
            {
                //eyeInfoText.text = "Saving..." + savingPercent + "%";
            }
            else if (scanningProgress == 3)//[loading]
            {
                loadingDotTime += Time.deltaTime;
                if (loadingDotTime > 0.2f)
                {
                    loadingDotTime = 0;
                    int    dotcount = 0;
                    string sss      = GameManager.Instance.GetInfoText();
                    foreach (char c in sss)
                    {
                        if (c == '.')
                        {
                            dotcount++;
                        }
                    }
                    if (dotcount % 30 == 0)
                    {
                        sss += "\r\n";
                    }
                    sss += '.';

                    GameManager.Instance.SetInfoText(sss);
                }
            }
            else if (scanningProgress == 4)//[scanning]
            {
                GameManager.Instance.ShowInfoTextAni("<size=120%><b>Please look around to scanning...<line-height=150%><size=100%>\nPress <color=#FFC000FF>Pad</b><line-height=80%><color=white><size=80%> :\nto save scene<b><line-height=150%><size=100%>\nPress <color=#FFC000FF>Trigger</b><line-height=80%><color=white><size=80%> :\nto cancel scanning");
                if (padpress)
                {
                    SRWorkControl.Instance.SaveScanning(
                        (percentage) => { GameManager.Instance.ShowInfoTextAni("<b>Saving...<color=#FFC000FF><size=120%>" + percentage + "%"); },
                        () =>
                    {
                        //save done then load...
                        StartLoadReconstructData();
                        scanningProgress = 3;
                    }
                        );
                    scanningProgress = 2;
                }
                else if (triggerpress)
                {
                    SRWorkControl.Instance.SetScanning(false);
                    scanningProgress = 1;
                    GameManager.Instance.infoTextStart();
                }
            }
            else if (scanningProgress == 5)
            {
                if (ReconstructManager.Instance.reconstructDataAnalyzeDone)
                {
                    manager.SwitchState(GameStateManager.GameState.SELECTWALL);
                }
            }
        }
 void _showWallSelectedDone()
 {
     Debug.Log("[GameStateSelectWall] wallSelectedDone start puffersh demo");
     manager.SwitchState(GameStateManager.GameState.PUFFERFISH);
 }
        public void UpdateState()
        {
            if (manager.PadTouchL)
            {
                robotController.TurnLeft();
            }
            else if (manager.PadTouchR)
            {
                robotController.TurnRight();
            }

            if (manager.PadKeyUp)
            {
                robotController.Stop();
            }

            if (manager.PadPressL && manager.PadIsFirstPress ||
                manager.PadPressR && manager.PadIsFirstPress)
            {
                robotController.SwitchDiscoLight();
            }

            if (robotController.GetDiscoLightRoot().gameObject.activeSelf)
            {
                MyHelpLayer.SetSceneLayer(robotController.GetDiscoLightRoot(), ARRender.UnityRenderWithDepthNoShadowLayer);
            }

            if (manager.PadPressUpward)
            {
                //robotController.MoveForwrad();
                robotController.stallHigh += Time.deltaTime * 0.9f;
                robotController.stallHigh  = Mathf.Clamp(robotController.stallHigh, 0.5f, 10);
            }
            else if (manager.PadPressDownward)
            {
                //robotController.MoveBack();
                robotController.stallHigh -= Time.deltaTime * 0.9f;
                robotController.stallHigh  = Mathf.Clamp(robotController.stallHigh, 0.5f, 10);
            }

            float triggerRatio = ViveInput.GetTriggerValue(HandRole.RightHand);

            if (triggerRatio > 0)
            {
                if (robotController != null)
                {
                    robotController.MoveForwrad(triggerRatio);
                }
                //Debug.Log("tvalue : " + tvalue);
            }

            if (GameManager.Instance.ViveIsGrip())
            {
                manager.SwitchState(GameStateManager.GameState.GARAGE);
            }

            //Recover to idle state
            if (ViveInput.GetPressUp(HandRole.RightHand, ControllerButton.Trigger) ||
                triggerRatio < 0.01f)
            {
                robotController.Stop();
            }
        }