示例#1
0
 void Update()
 {
     if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.MenuNavSelect))
     {
         ShowSavedGamesScreen();
     }
 }
示例#2
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Alpha0))
        {
            SwitchInputMode();
        }

        _cmdTriggerOutput = GetString_CmdTrigger();
        _cmdBoolOutput    = GetString_CmdBool();
        _cmdFloatOutput   = GetString_CmdFloat();

        int i = 0;

        foreach (Cmd_Trigger t in Enum.GetValues(typeof(Cmd_Trigger)))
        {
            if (ZeldaInput.GetCommand_Trigger(t))
            {
                _triggerTimeStamps[i] = _triggerDisplayDuration;
            }
            else
            {
                _triggerTimeStamps[i] -= Time.deltaTime;
                _triggerTimeStamps[i]  = Mathf.Max(_triggerTimeStamps[i], 0);
            }
            i++;
        }
    }
示例#3
0
    void ProcessInput()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            EquipSword("WoodenSword");
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            EquipSword("WhiteSword");
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            EquipSword("MagicSword");
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            EquipSword(null);
        }

        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.ToggleGodMode))
        {
            ToggleGodMode();
        }
        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.ToggleGhostMode))
        {
            ToggleGhostMode();
        }
        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.ToggleFlying))
        {
            ToggleFlying();
        }

        ProcessKeypadInput();
    }
示例#4
0
 bool WasOptionsButtonJustPressed()
 {
     if (ZeldaInput.AreAnyTouchControllersActive())
     {
         // TODO: Integrate OVRInput (Oculus Touch Controllers) with ZeldaInput
         return(OVRInput.GetDown(OVRInput.RawButton.X));
     }
     else
     {
         return(ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.ToggleOptionsMenu));
     }
 }
示例#5
0
    void Update()
    {
        UpdateCursor();

        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.MenuNavSelect))
        {
            PlaySelectSound();
            LoadEntry(CursorIndex);
        }
        else if (Application.isEditor && ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.EraseSaveEntry))      // TODO
        {
            EraseEntry(CursorIndex);
        }
    }
示例#6
0
    void Update()
    {
        if (!OptionsViewActive)
        {
            return;
        }

        UpdateCursor();

        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.MenuNavSelect))
        {
            _optionsView.ClickSelectedButton();
        }
    }
示例#7
0
文件: Player.cs 项目: Grivik/Zelda_VR
    void ProcessUserInput()
    {
        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.SwordAttack))
        {
            AttackWithSword();
        }

        if (_equippedItem != null)
        {
            Weapon_Gun_Bow bow = (weapon == null) ? null : weapon.GetComponent <Weapon_Gun_Bow>();

            if (weapon != null)
            {
                // Aim WeaponB

                /*Transform t = _playerController.WeaponContainerLeft;
                 * t.forward = _playerController.LineOfSight;
                 * if (bow == null)
                 * {
                 *  Vector3 fwd = t.forward;
                 *  fwd.y = 0;
                 *  t.forward = fwd;
                 * }*/
            }

            // Use Item?
            bool doUseItem = false;

            /*if (bow != null)
             * {
             *  doUseItem = ZeldaInput.GetButtonUp(ZeldaInput.Button.UseItemB);
             * }
             * else
             * {
             *  doUseItem = ZeldaInput.GetButtonDown(ZeldaInput.Button.UseItemB);
             * }*/
            doUseItem = ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.UseItemB);

            if (doUseItem)
            {
                if (weapon != null)
                {
                    AttackWithWeaponB();
                }

                _inventory.UseItemB();
            }
        }
    }
示例#8
0
文件: Player.cs 项目: Grivik/Zelda_VR
    void UpdateLikeLikeTrap()
    {
        if (!IsInLikeLikeTrap)
        {
            return;
        }

        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.SwordAttack))
        {
            if (++_likeLikeTrapCounter >= LIKE_LIKE_ESCAPE_COUNT)
            {
                IsInLikeLikeTrap = false;
            }
        }
    }
示例#9
0
 void Update()
 {
     // TODO: Implement a system for sending input events to active views.
     if (WasOptionsButtonJustPressed())
     {
         if (IsPauseAllowed_Options)
         {
             TogglePause_Options();
         }
     }
     else if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.ToggleInventory))
     {
         if (IsPauseAllowed_Inventory && !IsPaused_Options)
         {
             TogglePause_Inventory();
         }
     }
 }
示例#10
0
    public override void UpdateMovement()
    {
        if (HaltUpdateMovement)
        {
            return;
        }

        float moveHorzAxis = ZeldaInput.GetCommand_Float(ZeldaInput.Cmd_Float.MoveHorizontal);
        float moveVertAxis = ZeldaInput.GetCommand_Float(ZeldaInput.Cmd_Float.MoveVertical);
        bool  moveForward  = moveVertAxis > 0;
        bool  moveLeft     = moveHorzAxis < 0;
        bool  moveBack     = moveVertAxis < 0;
        bool  moveRight    = moveHorzAxis > 0;

        MoveScale = 1.0f;

        if ((moveForward && moveLeft) || (moveForward && moveRight) || (moveBack && moveLeft) || (moveBack && moveRight))
        {
            MoveScale = 0.70710678f;
        }

        MoveScale *= SimulationRate * Time.deltaTime;

        // Compute this for key movement
        float moveInfluence = Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;

        // Run
        if (ZeldaInput.GetCommand_Bool(ZeldaInput.Cmd_Bool.Run))
        {
            moveInfluence *= RunMultiplier;
        }


        Quaternion ort      = transform.rotation;
        Vector3    ortEuler = ort.eulerAngles;

        ortEuler.z = ortEuler.x = 0f;
        ort        = Quaternion.Euler(ortEuler);

        if (moveForward)
        {
            MoveThrottle += ort * (transform.lossyScale.z * moveInfluence * Vector3.forward);
        }
        if (moveBack)
        {
            MoveThrottle += ort * (transform.lossyScale.z * moveInfluence * BackAndSideDampen * Vector3.back);
        }
        if (moveLeft)
        {
            MoveThrottle += ort * (transform.lossyScale.x * moveInfluence * BackAndSideDampen * Vector3.left);
        }
        if (moveRight)
        {
            MoveThrottle += ort * (transform.lossyScale.x * moveInfluence * BackAndSideDampen * Vector3.right);
        }

        // Jump
        if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.Jump))
        {
            Jump();
        }

        // Rotation
        Vector3 euler = transform.rotation.eulerAngles;

        float rotateInfluence = SimulationRate * Time.deltaTime * RotationAmount * RotationScaleMultiplier;

        //if (!SkipMouseRotation)
        //{
        //    euler.y += Input.GetAxis("Mouse X") * rotateInfluence * 3.25f;
        //}

        moveInfluence = SimulationRate * Time.deltaTime * Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;

        float lookHorzAxis  = ZeldaInput.GetCommand_Float(ZeldaInput.Cmd_Float.LookHorizontal);
        float deltaRotation = lookHorzAxis * rotateInfluence * 3.25f;

        euler.y += deltaRotation;

        transform.rotation = Quaternion.Euler(euler);
    }