Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //if (!PauseSceneRoot) {
        //    PauseSceneRoot = GameObject.FindWithTag("PauseSceenRoot");
        //    if (PauseSceneRoot) {
        //        PauseSceneRoot.SetActive(false);
        //    }
        //}
        if (gamePlaying)
        {
            time += Time.deltaTime;
            //if (!isTestLevel && rooms.Length != 0) cc.zoomCamera(OnPlayer, OffPlayer);


            // log postion every second
            if (((int)time) != oldTime)
            {
                gameStateLog.LogPositions(Parameters.OnPlayer.transform.position, Parameters.OffPlayer.transform.position);
                oldTime = (int)time;
            }
        }
        if (!isTestLevel)
        {
            cc.changeCameraPos(rooms[currentRoom][0]);
        }

        //Time.timeScale = (InMenue) ? 0.00f : 1.00f;
        //if (PauseSceneRoot)
        //{
        //    PauseSceneRoot.SetActive((!LevelController.gameGoing()) ? false : InMenue);
        //}

        if (Input.GetButtonDown(PlayerInputTranslator.GetMenu(Player.ON)) || Input.GetButtonDown(PlayerInputTranslator.GetMenu(Player.OFF)))
        {
            if (pauseGame)
            {
                pauseUI.SetActive(false);
                Time.timeScale = 1f;
                pauseGame      = false;
            }
            else
            {
                pauseUI.SetActive(true);
                Time.timeScale = 0f;
                pauseGame      = true;
                resumeBtn.Select();
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //if (!LevelController.gameGoing()) return;

        try
        {
            if (Input.GetButton(PlayerInputTranslator.GetLeftInteract(Player.ON)))
            {
                if (Time.time - lastPressedOn > pressThreshold)
                {
                    OnInteract(Parameters.OnPlayer);
                    lastPressedOn = Time.time;
                }
            }
            if (Input.GetButton(PlayerInputTranslator.GetLeftInteract(Player.OFF)))
            {
                if (Time.time - lastPressedOn > pressThreshold)
                {
                    Parameters.OffPlayer.GetComponent <Animator>().SetTrigger("Use Wrong Arm");
                }
            }
            if (Input.GetButton(PlayerInputTranslator.GetRightInteract(Player.OFF)))
            {
                if (Time.time - lastPressedOff > pressThreshold)
                {
                    OnInteract(Parameters.OffPlayer);
                    lastPressedOff = Time.time;
                }
            }
            if (Input.GetButton(PlayerInputTranslator.GetRightInteract(Player.ON)))
            {
                if (Time.time - lastPressedOn > pressThreshold)
                {
                    Parameters.OnPlayer.GetComponent <Animator>().SetTrigger("Use Wrong Arm");
                }
            }

            if ((Input.GetButton(PlayerInputTranslator.GetMenu(Player.ON)) || Input.GetButton(PlayerInputTranslator.GetMenu(Player.OFF))) ||
                (LevelController.InMenue && (Input.GetButton(PlayerInputTranslator.GetPickup(Player.ON)) || Input.GetButton(PlayerInputTranslator.GetPickup(Player.OFF))))
                )
            {
                if ((DateTime.Now - lastPressedOnMenue).TotalSeconds > pressThresholdMenue)
                {
                    LevelController.ToggleMenue();
                    lastPressedOnMenue = DateTime.Now;
                }
            }


            if (Input.GetButtonUp(PlayerInputTranslator.GetDismiss(Player.ON)) || Input.GetButtonUp(PlayerInputTranslator.GetDismiss(Player.OFF)))
            {
                print("y");
                hudController.DismissDialogue();
                npc.Dismiss();
            }

            /*
             *          if (Input.GetButton(PlayerInputTranslator.GetMenu(Player.OFF)))
             *          {
             *                  if (Time.time - lastPressedOffMenue > pressThresholdMenue)
             *                  {
             *                          LevelController.ToggleMenue();
             *                          lastPressedOffMenue = Time.time;
             *                  }
             *          }*/
        }
        catch (System.NullReferenceException)
        {
            ;
        }
    }