コード例 #1
0
    protected void CheckForReload()
    {
        int currentAmmo  = _shootingBehaviour.CurrentWeapon.Ammo;
        int magazineSize = _shootingBehaviour.CurrentWeapon.MagazineSize;

        if (currentAmmo == magazineSize)
        {
            return;
        }

        if (currentAmmo == 0)
        {
            _shootingBehaviour.Reload();
        }

        if (State == EnemyState.passive)
        {
            _shootingBehaviour.Reload();
        }
    }
コード例 #2
0
    private void HandleGeneralInput()
    {
        if (Input.GetButtonUp("Fire"))
        {
            ShootingBehaviour.Release();
        }

        if (Input.GetButton("Fire"))
        {
            if (_swithcTakeOverBehaviour.IsSwitching)
            {
                _swithcTakeOverBehaviour.SwitchTakeOver();
            }
            else
            {
                ShootingBehaviour.Fire();
            }
        }

        if (Input.GetButton("Defend"))
        {
            _defendingBehaviour.Defend();
        }

        if (Input.GetButtonDown("Reload"))
        {
            ShootingBehaviour.Reload();
        }

        if (Input.GetButtonDown("Stealth") && !_takeOverBehaviour.TakenOver)
        {
            _stealthBehaviour.ToggleStealth();
        }

        if (Input.GetButtonDown("Interact"))
        {
            _interActionBehaviour.Interact();
        }

        if (Input.GetButtonDown("Switch") && _takeOverBehaviour.TakenOver)
        {
            _swithcTakeOverBehaviour.Switch();
        }
    }