Exemplo n.º 1
0
        // Update is called once per frame
        void Update()
        {
            if (GJ_InputManager.PressedInteract())
            {
                GJ_DialogManager.ShowDialog(interactMsg);
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                GJ_SceneLoader.LoadScene(GJ_SceneSetup.SCENES.MAIN_MENU);
            }
        }
Exemplo n.º 2
0
 void Update()
 {
     if (GJ_InputManager.PressedEscape() && !m_chara.m_movementIsBlocked)
     {
         if (!m_pause)
         {
             Time.timeScale = 0;
             m_pause        = true;
             CantMove();
             inGameMenuCanvas.SetActive(true);
         }
         else
         {
             Time.timeScale = 1;
             m_pause        = false;
             CanMove();
             inGameMenuCanvas.SetActive(false);
         }
     }
 }
        // Fixed update is called in sync with physics
        private void FixedUpdate()
        {
            if (m_Character.m_movementIsBlocked)
            {
                return;
            }

            float h = GJ_InputManager.LeftJoystickHorizontal();
            float v = m_Character.m_inShadows ? 0 : GJ_InputManager.LeftJoystickVertical();

            m_Move  = v * Vector3.forward + h * Vector3.right;
            m_Move *= m_MoveMultiplier;

            if ((h != 0 || v != 0) && !checkMoveableTerrain(transform.position + transform.up, m_Move, 1.5f))
            {
                m_Character.Move(Vector3.zero, 0, 0);
                return;
            }


            // pass all parameters to the character control script
            m_Character.Move(m_Move, h, v);
        }
        private void Update()
        {
            if (GJ_InputManager.PressedInteract())
            {
                Debug.Log("Interact button pressed");

                if (!m_Character.m_inShadows)
                {
                    GameObject go = m_Character.CheckFrontObject();

                    if (go)
                    {
                        if (go.tag == GJ_GameSetup.Tags.SHAWDOW_WALL)
                        {
                            if (GJ_GameManager.Instance.Data.pressedFirstButton)
                            {
                                EnterTheWall();
                            }
                            else
                            {
                                GJ_DialogManager.ShowDialog(GJ_FlowchartSetup.Messages.NO_PRESSED_BUTTONS);
                            }
                        }
                        GJ_Interactable interactable = go.GetComponent <GJ_Interactable>();
                        if (interactable)
                        {
                            interactable.Action();
                        }
                    }
                }
                else
                {
                    GJ_SceneController.Instance.SwitchColliders();
                    EnterTheWall();
                }
            }
        }