Esempio n. 1
0
    public override void _PhysicsProcess(float delta)
    {
        // Clear all inputs and reapply
        _input.buttons = 0;

        if (Main.i.gameInputActive)
        {
            _input.ReadGodotInputs();
            // TODO - replace this with stuff in FPSInput
            // bleh, mouse wheel events are ONLY on just release...?
            // https://godotengine.org/qa/30666/how-do-i-get-input-from-the-mouse-wheel
            if (Input.IsActionJustReleased("next_slot"))
            {
                _input.buttons |= FPSInput.BitNextSlot;
            }
            if (Input.IsActionJustReleased("prev_slot"))
            {
                _input.buttons |= FPSInput.BitPrevSlot;
            }
        }

        _fpsCtrl.ProcessMovement(_input, delta);
        Main.i.SetDebugText(_fpsCtrl.debugStr);

        if (_input.isBitOn(FPSInput.BitNextSlot))
        {
            _inventory.SelectNextWeapon();
        }
        if (_input.isBitOn(FPSInput.BitPrevSlot))
        {
            _inventory.SelectPrevWeapon();
        }

        if (_input.isBitOn(FPSInput.BitSlot1))
        {
            _inventory.SelectWeaponByIndex(0);
        }
        if (_input.isBitOn(FPSInput.BitSlot2))
        {
            _inventory.SelectWeaponByIndex(1);
        }
        if (_input.isBitOn(FPSInput.BitSlot3))
        {
            _inventory.SelectWeaponByIndex(2);
        }
        if (_input.isBitOn(FPSInput.BitSlot4))
        {
            _inventory.SelectWeaponByIndex(3);
        }

        _inventory.Tick(
            delta,
            _input.isBitOn(FPSInput.BitAttack1),
            _input.isBitOn(FPSInput.BitAttack2)
            );

        _inventory.FillHudStatus(_hudState);
        Main.i.ui.SetHudState(_hudState);
    }
Esempio n. 2
0
    public override void _PhysicsProcess(float delta)
    {
        if (Main.i.gameInputActive)
        {
            _input.ReadGodotInputs();
        }
        else
        {
            _input.Clear();
        }

        _fpsCtrl.ProcessMovement(_input, delta);
        //Main.i.SetDebugText(_fpsCtrl.debugStr);

        if (_input.isBitOn(FPSInput.BitNextSlot))
        {
            _inventory.SelectNextWeapon();
        }
        if (_input.isBitOn(FPSInput.BitPrevSlot))
        {
            _inventory.SelectPrevWeapon();
        }

        if (_input.isBitOn(FPSInput.BitSlot1))
        {
            _inventory.SelectWeaponByIndex(0);
        }
        if (_input.isBitOn(FPSInput.BitSlot2))
        {
            _inventory.SelectWeaponByIndex(1);
        }
        if (_input.isBitOn(FPSInput.BitSlot3))
        {
            _inventory.SelectWeaponByIndex(2);
        }
        if (_input.isBitOn(FPSInput.BitSlot4))
        {
            _inventory.SelectWeaponByIndex(3);
        }
        if (_input.isBitOn(FPSInput.BitSlot5))
        {
            _inventory.SelectWeaponByIndex(4);
        }
        if (_input.isBitOn(FPSInput.BitSlot6))
        {
            _inventory.SelectWeaponByIndex(5);
        }
        if (_input.isBitOn(FPSInput.BitSlot7))
        {
            _inventory.SelectWeaponByIndex(6);
        }
        if (_input.isBitOn(FPSInput.BitSlot8))
        {
            _inventory.SelectWeaponByIndex(7);
        }

        AttackSource src = new AttackSource();

        src.team       = GetTeam();
        src.ignoreBody = _body;
        src.actorId    = _entId;

        bool secondaryOnToggled = _input.hasBitToggledOn(FPSInput.BitAttack2);

        EquippableTickInfo info = new EquippableTickInfo(
            _input.isBitOn(FPSInput.BitAttack1),
            _input.hasBitToggledOn(FPSInput.BitAttack1),
            _input.isBitOn(FPSInput.BitAttack2),
            _input.hasBitToggledOn(FPSInput.BitAttack2),
            src);

        _inventory.Tick(delta, info);

        _inventory.FillHudStatus(_hudState);
        _hudState.health = _health;
        if (_viewModel != null)
        {
            _viewModel.SetViewModelState(_hudState.view);
        }
        Main.i.ui.SetHudState(_hudState);
    }