Ejemplo n.º 1
0
 private void Actions()
 {
     if (InputManager.AButton())
     {
         if (inApp)
         {
             ExecuteOnAppAction();
         }
         else
         {
             SetApp(currentApp, true);
         }
     }
     if (InputManager.BButton())
     {
         if (inApp)
         {
             SetApp(currentApp, false);
         }
         else
         {
             ExitCellScreen();
         }
     }
 }
Ejemplo n.º 2
0
 private void Update()
 {
     if (InputManager.AButton())
     {
         Debug.Log(InputManager.Joystick());
     }
 }
Ejemplo n.º 3
0
    private void Update()
    {
        if (InputManager.AButton())
        {
            Debug.Log("Success");
        }

        if (InputManager.AButtonTwo())
        {
            Debug.Log("MegaSuccess");
        }

        Vector2 moveInput = new Vector2(Input.GetAxisRaw("2J_MainHorizontal"), Input.GetAxisRaw("2J_MainVertical"));

        moveVelocity = moveInput.normalized * speed;

        if (moveInput.magnitude == 0)
        {
            //           anim.SetBool("isMoving", false);
        }
        else
        {
            //          anim.SetBool("isMoving", true);
        }

        if (cakeCount > 0 && Input.GetKeyDown(KeyCode.Space))
        {
            speedBoost();
        }
    }
Ejemplo n.º 4
0
    private void Update()
    {
        m_horz = InputManager.LeftHorizontal(m_iPlayerNumber);
        m_vert = InputManager.LeftVertical(m_iPlayerNumber);

        if (InputManager.LeftHorizontal(m_iPlayerNumber) != 0 || InputManager.LeftVertical(m_iPlayerNumber) != 0)
        {
            m_bPlayerMoveInput = true;
        }
        else
        {
            m_bPlayerMoveInput = false;
        }

        if ((InputManager.AButton(m_iPlayerNumber) || Input.GetKeyDown(KeyCode.Space)) && !m_bDashCooldown)
        {
            m_bPlayerDashInput = true;
            m_dashCooldown     = 2.5f;
            m_bDashCooldown    = true;
            m_soundEffect.PlayOneShot(m_dashSound);
        }

        if (m_bDashCooldown)
        {
            m_dashCooldown -= Time.deltaTime;
            if (m_dashCooldown <= 0f)
            {
                m_bDashCooldown = false;
            }
        }
    }
Ejemplo n.º 5
0
    void DetectInput()
    {
        jump         = InputManager.AButton();
        altAttack    = InputManager.RightTrigger();
        dash         = InputManager.XButton();
        nextLane     = InputManager.RightBumper();
        previousLane = InputManager.LeftBumper();

        horizontalAxis    = InputManager.MainHorizontal();
        verticalAxis      = InputManager.MainVertical();
        altHorizontalAxis = InputManager.AltHorizontal();
        altVerticalAxis   = InputManager.AltVertical();
        dHorizontalAxis   = InputManager.DHorizontal();
        dVerticalAxis     = InputManager.DVertical();

        LookAtAltStickPosition(InputManager.AltJoystick());

        if (nextLane)
        {
            GridManager.instance.SetSelectedRow(1);
        }
        if (previousLane)
        {
            GridManager.instance.SetSelectedRow(-1);
        }

        if ((dVerticalAxis > 0) && canDVerticalAxis)
        {
            canDVerticalAxis = false;
        }
        else if (dVerticalAxis < 0 && canDVerticalAxis)
        {
            canDVerticalAxis = false;
        }
        else if (dVerticalAxis == 0)
        {
            canDVerticalAxis = true;
        }

        if ((dHorizontalAxis > 0) && canDHorizontalAxis)
        {
            ColorManager.instance.SetSelectedColor(1);
            canDHorizontalAxis = false;
        }
        else if (dHorizontalAxis < 0 && canDHorizontalAxis)
        {
            ColorManager.instance.SetSelectedColor(-1);
            canDHorizontalAxis = false;
        }
        else if (dHorizontalAxis == 0)
        {
            canDHorizontalAxis = true;
        }
    }
Ejemplo n.º 6
0
 void Update()
 {
     showMenu();
     if (PlayerIsInside)
     {
         if (InputManager.AButton(false) || Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("Confirm"))
         {
             SceneManager.LoadScene(sceneNameForLoader);
         }
     }
 }
Ejemplo n.º 7
0
    private void Update()
    {
        if (InputManager.AButton())
        {
            m_selectedButton.OnClick(m_selectedButton.m_strOnClickParameter);
        }

        Vector3 v3PrimaryInputDirection = InputManager.PrimaryInput();

        NaviageButtons(v3PrimaryInputDirection, m_lActivePanelButtons);
    }
Ejemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) || InputManager.AButton(false) || InputManager.BButton(false))
        {
            if (option.ActualID == 0)
            {
                GameManager.isPaused = true;

                SceneManager.LoadScene(SceneNames.MapMenu);
            }
        }
    }
Ejemplo n.º 9
0
    onPreUpdate()
    {
        if (InputManager.XButton())
        {
            MSM.pushState(GetComponent <fsmMarioMachine>().s_Pause);
        }

        else if (InputManager.BButton())
        {
            MSM.setState(GetComponent <fsmMarioMachine>().s_Jump);
        }

        else if (InputManager.AButton())
        {
            if (GetComponent <fsmMarioMachine>().arrGO_Contacts.Length < 0)
            {
                for (int i = 0; i < GetComponent <fsmMarioMachine>().arrGO_Contacts.Length; ++i)
                {
                    if (GetComponent <fsmMarioMachine>().arrGO_Contacts[i].GetComponent <cCharacter>().interact(MSM as fsmMarioMachine))
                    {
                        MSM.setState(GetComponent <fsmMarioMachine>().s_Dialog_CutScene);
                    }
                }
            }
        }

        /**
         * ************************
         * *  Check run button
         * ************************
         * */
        if (InputManager.YButton())
        {
            GetComponent <cCharacter>().m_Stats.m_running = true;
        }
        else
        {
            GetComponent <cCharacter>().m_Stats.m_running = false;
        }

        /**
         * ************************
         * *  Check stick input
         * ************************
         * */
        if (InputManager.Joystick() != Vector3.zero)
        {
            MSM.pushState(GetComponent <fsmMarioMachine>().s_WalkRun);
        }
    }
Ejemplo n.º 10
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) || InputManager.AButton(false) || Input.GetButtonDown("Confirm"))
     {
         if (option.ActualID == 0)
         {
             GameManager.isPaused = !GameManager.isPaused;
         }
         if (option.ActualID == 1)
         {
             SceneManager.LoadScene(SceneNames.MapMenu);
         }
     }
 }
Ejemplo n.º 11
0
    void CallJumpWalk()
    {
        AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0);

        if (GroundCheck() && stateInfo.fullPathHash == groundedStateHash)
        {
            if (InputManager.AButton())
            {
                // Is jumping bool is set to true so the slopeRays aren't active
                isJumping = true;
                float jumpVelocityWalk = Mathf.Sqrt(-2 * gravity * jumpHeightIdle);
                velocityY = jumpVelocityWalk;
                anim.SetTrigger("JumpWalk");
            }
        }
    }
Ejemplo n.º 12
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(InputManager.MainJoystickXZ());

        if (text != null)
        {
            text.text  = "A_Button: " + InputManager.AButton(true) + "   ";
            text.text += "B_Button: " + InputManager.BButton(true) + "\n";
            text.text += "X_Button: " + InputManager.XButton(true) + "   ";
            text.text += "Y_Button: " + InputManager.YButton(true) + "\n";
            text.text += "L_Button: " + InputManager.LButton(true) + "   ";
            text.text += "R_Button: " + InputManager.RButton(true) + "\n";
            text.text += "Horizontal_Axis: " + InputManager.MainHorizontal() + "\n";
            text.text += "Vertical: " + InputManager.MainVertical() + "\n";
        }
    }
 private void Actions()
 {
     if (InputManager.BPressed())
     {
         _player.speed = 2.5f;
     }
     else
     {
         _player.speed = 1f;
     }
     if (_player.CanInteract)
     {
         if (InputManager.AButton())
         {
             _player.CurrentState = new PlayerCellphoneState(_player, _player.Target.GetComponent <PersonBehaviour>().person);
         }
     }
 }
Ejemplo n.º 14
0
 // Update is called once per frame
 void Update()
 {
     if (InputManager.BButton())
     {
         menu.sprite = attack;
     }
     if (InputManager.AButton())
     {
         menu.sprite = etc;
     }
     if (InputManager.YButton())
     {
         menu.sprite = item;
     }
     if (InputManager.XButton())
     {
         menu.sprite = special;
     }
 }
Ejemplo n.º 15
0
    private void Update()
    {
        if (InputManager.AButton())
        {
            if (m_selectedPerkButton.IsHighlighted)
            {
                m_selectedPerkButton.OnClick();
            }
            else
            {
                m_bPerkTreeIsSelected = false;
                m_selectedPerkButton.m_backButton.GetComponent <PerkTreeBackButton>().IsHightlighted = false;
                m_selectedPerkButton.m_backButton.GetComponent <PerkTreeBackButton>().OnClick();
            }
        }

        NavigatePerkTree();

        m_perkTreeDecriptionText.text = m_selectedPerkButton.m_strPerkCanvasDescription;
    }
Ejemplo n.º 16
0
 void Update()
 {
     if (SceneManager.GetActiveScene().name == "MainMenu")
     {
         if (InputManager.AButton(1) || InputManager.AButton(2))
         {
             if (players.Length > 0)
             {
                 if (SceneManager.GetSceneByName(_firstScene) != null)
                 {
                     players[0].playerController.UseGate(_firstScene, -1, false);
                 }
                 else
                 {
                     Debug.LogWarning($"{ _firstScene } not found. Unable to load \"first scnene\"");
                 }
             }
         }
     }
 }
Ejemplo n.º 17
0
 // Update is called once per frame
 void Update()
 {
     timeTrans += Time.deltaTime;
     if (InputManager.AButton() || InputManager.StartButton() || InputManager.BackButton())
     {
         dif.changeSecne = true;
         nextScene       = true;
     }
     if (timeTrans > 19)
     {
         SceneManager.LoadScene("INICIO");
     }
     if (nextScene)
     {
         dif.obscurecer();
         if (dif.readyToChange)
         {
             SceneManager.LoadScene("MAINMENU"); //poner escena de inicio
         }
     }
 }
Ejemplo n.º 18
0
    void Move()
    {
        if (controller.isGrounded)
        {
            verticalVelocity = -gravity * Time.deltaTime;
        }
        else
        {
            verticalVelocity -= gravity * Time.deltaTime;
        }

        if (InputManager.AButton() && controller.isGrounded)
        {
            _iMove = new Jump();
            _iMove.Move(this);
        }

        else if (!isDashing)
        {
            _iMove = new HorizontalMovement();
            _iMove.Move(this);
        }
    }
Ejemplo n.º 19
0
    private void Update()
    {
        if (m_bFadeIn && !m_bFadeInComplete)
        {
            if (ImageFadeIn(m_fadeImage, m_fFadeSpeed))
            {
                m_bFadeInComplete = true;
                m_fadeImage.gameObject.SetActive(false);
            }
        }
        else if (!m_bFadeIn && !m_bFadeOutComplete)
        {
            m_fadeImage.gameObject.SetActive(true);

            if (ImageFadeOut(m_fadeImage, m_fFadeSpeed))
            {
                m_bFadeOutComplete = true;
                if (m_bPlayTutorial)
                {
                    LevelManager.m_levelManager.LoadNextLevelAsyncOperation.allowSceneActivation = true;
                }
                else
                {
                    GameManager.m_gameManager.LoadLevelOne();
                }
            }
        }

        if (InputManager.AButton())
        {
            m_selectedButton.OnClick(m_selectedButton.m_strOnClickParameter);
        }

        Vector3 v3PrimaryInputDirection = InputManager.PrimaryInput();

        NavigateButtons(v3PrimaryInputDirection, m_lActivePanelButtons);
    }
Ejemplo n.º 20
0
    /**
     * ************************
     * *  FixedUpdate runs the onPreUpdate & onUpdate
     * ************************
     * */
    private void FixedUpdate()
    {
        {
            /**
             * * Pause
             * */
            if (InputManager.XButton())
            {
                //TODO: pause
            }
        }

        {
            /**
             * * Interact
             * */
            if (InputManager.AButton())
            {
            }
        }

        {
            /**
             * * Jump input
             * */
            if (InputManager.BButton())
            {
                if (!m_Stats.m_jumping)
                {
                    JumpStart();
                }
            }
            if (m_Stats.m_jumping)
            {
                JumpUpdate();
            }
        }

        {
            /**
             * * Stick input
             * */
            if (InputManager.Joystick() == Vector3.zero)
            {
                m_Stats.m_moving = false;
            }
            else
            {
                m_Stats.m_moving = true;
            }
        }

        {
            /**
             * *  Check run button
             * */
            if (Input.GetButtonDown("Boton_Y"))
            {
                m_Stats.m_running = true;
            }
            else if (Input.GetButtonUp("Boton_Y"))
            {
                m_Stats.m_running = false;
            }
        }

        {
            /**
             * *  Movement
             * */
            if (m_Stats.m_moving)
            {
                m_Stats.m_direction = InputManager.Joystick() * Time.fixedDeltaTime * m_Stats.m_moveSpeed;
                bool horizontal = false;
                bool vertical   = false;
                if (Mathf.Abs(InputManager.EjeHorizontal()) >= gUtilities.kHORIZONTAL_DIR)
                {
                    horizontal = true;
                }
                if (Mathf.Abs(InputManager.EjeVertical()) >= gUtilities.kHORIZONTAL_DIR)
                {
                    vertical = true;
                }
                if (horizontal && vertical)
                {
                    m_Stats.m_direction.x *= gUtilities.kHORIZONTAL_DIR;
                    m_Stats.m_direction.y *= gUtilities.kVERTICAL_DIR;
                }
                if (m_Stats.m_running)
                {
                    m_Stats.m_direction *= m_Stats.m_runSpeed;
                }
                gameObject.transform.position += m_Stats.m_direction;
            }
        }
    }
Ejemplo n.º 21
0
 // Update is called once per frame
 void Update()
 {
     marco.GetComponent <SpriteRenderer>().sprite.texture.mipMapBias = maxmip;
     if (cantCharge)
     {
         erroMips();
         return;
     }
     if (bsaltoinverso)
     {
         saltoInverso();
     }
     if (!dif.sceneIsVisible)
     {
         return;
     }
     if (marco.transform.localScale.y < 1)
     {
         escale += 0.03f;
         if (escale > 1)
         {
             escale = 1;
         }
         Vector3 VEC = new Vector3(1.0f, escale, 0.0f);
         marco.transform.localScale = VEC;
         return;
     }
     else
     {
         allMenu.SetActive(true);
     }
     if (!finishJump)
     {
         jump();
     }
     if (jostick_vertival)
     {
         if (!InputManager.jostickMoveVertical() && !InputManager.DOWNButton() && !InputManager.UPButton())
         {
             jostick_vertival = false;
         }
         else
         {
             return;
         }
     }
     if ((Input.GetKeyDown(KeyCode.S) && indexPos < 4) || (InputManager.jostickMoveVertical() && indexPos < 4) || (InputManager.DOWNButton() && indexPos < 4))
     {
         if (InputManager.Joystick().y <= 0 || InputManager.DOWNButton())
         {
             jostick_vertival = true;
             indexPos++;
             this.transform.position = pos[indexPos];
         }
         else if (Input.GetKeyDown(KeyCode.S))
         {
             indexPos++;
             this.transform.position = pos[indexPos];
         }
     }
     if (Input.GetKeyDown(KeyCode.W) && indexPos > 0 || (InputManager.jostickMoveVertical() && indexPos > 0) || (InputManager.UPButton() && indexPos > 0))
     {
         if (InputManager.Joystick().y >= 0 || InputManager.UPButton())
         {
             jostick_vertival = true;
             indexPos--;
             this.transform.position = pos[indexPos];
         }
         else if (Input.GetKeyDown(KeyCode.W))
         {
             indexPos--;
             this.transform.position = pos[indexPos];
         }
     }
     if (Input.GetKey(KeyCode.Return) || InputManager.AButton() || InputManager.YButton() || InputManager.StartButton())
     {
         jostick_vertival = true;
         select();
     }
 }
Ejemplo n.º 22
0
    void Update()
    {
        //Rotation

        transform.rotation = Quaternion.Euler(0f, 0f, 0f);


        // Movement

        float axisX = InputManager.MainHorizontal();

        transform.Translate(new Vector3(axisX, 0) * Time.deltaTime * speed);
        if (axisX < 0)
        {
            Player.flipX    = true;
            BodyCol.offset  = new Vector2(-0.1f, 0.05f);
            FeetCol.offset  = new Vector2(-0.15f, -0.5f);
            SwordCol.offset = new Vector2(-0.85f, 0);
        }
        else if (axisX > 0)
        {
            Player.flipX    = false;
            BodyCol.offset  = new Vector2(0.1f, 0.05f);
            FeetCol.offset  = new Vector2(0.15f, -0.5f);
            SwordCol.offset = new Vector2(0.85f, 0);
        }

        if (InputManager.RBButton())
        {
            if (countGranade != 0)
            {
                Instantiate(granada, transform.position + new Vector3(0f, 1f, 0f), Quaternion.identity);
            }
            else
            {
                Invoke("Counter", 18000);
            }
        }
        // Jump

        if (InputManager.AButtonDown() && Onfloor)
        {
            jumpKeyHeld = true;
            GetComponent <Rigidbody2D>().AddForce(Vector3.up * jumpImpulse, ForceMode2D.Impulse);
        }

        if (InputManager.AButtonUp())
        {
            countDown   = 0.3f;
            jumpKeyHeld = false;
        }

        else if (InputManager.AButton())
        {
            countDown -= Time.deltaTime;
            if (jumpKeyHeld && countDown > 0f)
            {
                GetComponent <Rigidbody2D>().AddForce(Vector3.up * 10 * jumpForce, ForceMode2D.Force);
            }
        }

        if (GetComponent <Rigidbody2D>().velocity.y < 0)
        {
            GetComponent <Rigidbody2D>().velocity += Vector2.up * Physics2D.gravity.y * (fall) * Time.deltaTime;
        }
    }
Ejemplo n.º 23
0
    // Update is called once per frame
    void Update()
    {
        if (!dif.sceneIsVisible)
        {
            return;
        }
        if (selection.isDone)
        {
            dif.changeSecne = true;
            dif.obscurecer();
            if (!dif.readyToChange)
            {
                return;
            }
            SceneManager.LoadScene("PROLOGO");
        }
        if (selection.bLetterMove)
        {
            selection.moveLetter();
            return;
        }
        if (selection.ismoveHand)
        {
            fila    = max_fila;
            columna = max_columna;
            this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            selection.ismoveHand    = false;
        }
        if (jostick_vertival)
        {
            if (!InputManager.jostickMoveVertical() && !InputManager.DOWNButton() && !InputManager.UPButton())
            {
                jostick_vertival = false;
            }
            else
            {
                return;
            }
        }
        if (jostick_horizontal)
        {
            if (!InputManager.jostickMoveHorizontal() && !InputManager.RightButton() && !InputManager.LefhtButton())
            {
                jostick_horizontal = false;
            }
            else
            {
                return;
            }
        }
        if ((InputManager.jostickMoveVertical() || InputManager.DOWNButton()))
        {
            if (InputManager.Joystick().y < 0 || InputManager.DOWNButton())
            {
                jostick_vertival = true;
                fila++;
                if (fila > max_fila)
                {
                    fila = 0;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.S))
            //{
            //    fila++;
            //    if (fila > max_fila)
            //        fila = 0;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if ((InputManager.jostickMoveVertical() || InputManager.UPButton()))
        {
            if (InputManager.Joystick().y > 0 || InputManager.UPButton())
            {
                jostick_vertival = true;
                fila--;
                if (fila < 0)
                {
                    fila = max_fila;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.W))
            //{
            //    fila--;
            //    if (fila < 0)
            //        fila = max_fila;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if (InputManager.jostickMoveHorizontal() || InputManager.RightButton())
        {
            if (InputManager.Joystick().x >= 0 || InputManager.RightButton())
            {
                jostick_horizontal = true;
                columna++;
                if (columna > max_columna)
                {
                    columna = 0;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.D))
            //{
            //    columna++;
            //    if (columna > max_columna)
            //        columna = 0;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if (InputManager.jostickMoveHorizontal() || InputManager.LefhtButton())
        {
            if (InputManager.Joystick().x <= 0 || InputManager.LefhtButton())
            {
                jostick_horizontal = true;
                columna--;
                if (columna < 0)
                {
                    columna = max_columna;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.A))
            //{
            //    columna--;
            //    if (columna < 0)
            //        columna = max_columna;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }

        if (InputManager.AButton() || InputManager.YButton())
        {
            selection.addLetter(fila, columna);
        }
        if (InputManager.BButton())
        {
            selection.backspace();
        }
        if (InputManager.StartButton())
        {
            fila    = max_fila;
            columna = max_columna;
            this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            selection.ismoveHand    = false;
        }
    }