Esempio n. 1
0
    private void Update()
    {
        if (blocked.value)
        {
            statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_HORIZONTAL, 0f);
            statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_VERTICAL, 0f);
            return;
        }

        statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_HORIZONTAL, ReInput.players.GetPlayer(playerIndex).GetAxisRaw(GlobalSymbol.INPUTACTION_MoveHorizontal));
        statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_VERTICAL, ReInput.players.GetPlayer(playerIndex).GetAxisRaw(GlobalSymbol.INPUTACTION_MoveVertical));
        if (GetButtonDown(GlobalSymbol.INPUTACTION_Collect) || GetButtonDown(GlobalSymbol.INPUTACTION_Grab))
        {
            if (hand.equipped)
            {
                hand.Use();
                return;
            }
        }
        if (GetButtonDown(GlobalSymbol.INPUTACTION_Collect) || GetButtonDown(GlobalSymbol.INPUTACTION_Grab))
        {
            characterInteraction.Interact();
            return;
        }
    }
Esempio n. 2
0
    private void Update()
    {
        if (blocked.value)
        {
            statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_HORIZONTAL, 0f);
            statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_VERTICAL, 0f);
            return;
        }

        statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_HORIZONTAL, GetHorizontal());
        statCollection.SetStatValue(GlobalSymbol.INPUTVAR_MOVE_VERTICAL, GetVertical());
        if (GetButtonDown(GlobalSymbol.INPUTACTION_Collect) || GetButtonDown(GlobalSymbol.INPUTACTION_Grab))
        {
            if (hand.equipped)
            {
                hand.Use();
                return;
            }
        }
        if (GetButtonDown(GlobalSymbol.INPUTACTION_Collect) || GetButtonDown(GlobalSymbol.INPUTACTION_Grab))
        {
            characterInteraction.Interact();
            return;
        }
    }
Esempio n. 3
0
    private void Update()
    {
        // For test purposess
        debugCommand();

        if (Time.deltaTime > 0)
        {
            Hashtable inputs = fetchInputs();

            // Move the character
            movementScript.MoveCharacter(inputs, true);

            // Move the camera
            if (CameraManager.Instance.CurrentCameraType != "")
            {
                switch (CameraManager.Instance.CurrentCameraType)
                {
                case CameraManager.FPS_CAMERA:
                    CameraManager.Instance.CurrentCamera.GetComponent <FPSCameraControl>().RotateCameraWithInput(inputs, true);
                    break;
                }
            }

            // Interect with the environment and maybe try to select a gameobject
            m_interactionScript.Interact((bool)inputs["interactInput"]);

            if ((bool)inputs["pauseInput"])
            {
                Pause();
            }
        }
    }
Esempio n. 4
0
 private void InteractWithCharacter()
 {
     if (Input.GetKeyDown(KeyCode.R))
     {
         //Si en la dirección del próximo movimiento hay un collider del layer definido como obstáculo no se puede mover
         RaycastHit2D rHitCharacter = Physics2D.Raycast(rayOrigin.position, direccionRayo, tamanioCasilla / 2.0f, layerCharacter);
         if (rHitCharacter)
         {
             CharacterInteraction character = rHitCharacter.collider.gameObject.GetComponent <CharacterInteraction>();
             character.Interact();
         }
     }
 }