Beispiel #1
0
 //hand off the reloading/shooting stuff to the currently equipped weapon
 protected void Reload()
 {
     if (HasWeapons)
     {
         CurrentWeapon.Reload();
     }
 }
Beispiel #2
0
    // Reload Weapon
    public void Reload()
    {
        if (CurrentWeapon == null)
        {
            return;
        }

        CurrentWeapon.Reload();
        UpdateWeaponUI();
    }
Beispiel #3
0
    public void Reload()
    {
        if (CurrentWeapon == null)
        {
            return;
        }

        CurrentWeapon.Reload();
        if (character.CharacterType == Character.CharacterTypes.Player)
        {
            UIManager.Instance.UpdateAmmo(CurrentWeapon.CurrentAmmo, CurrentWeapon.MagazineSize);
        }
    }
Beispiel #4
0
        /// <summary>
        /// takes the reload action.
        /// </summary>
        /// <param name="weapon">current weapon</param>
        /// <returns></returns>
        public override bool ActionReload(GameWeapon weapon)
        {
            //  If weapon reloaded, action reload
            if (CurrentWeapon.IsPossibleToReload())
            {
                CurrentWeapon.Reload(this.UnitType);

                engageAction = Action.Reload;

                return(true);
            }

            return(false);
        }
    /*
     * Reloads the current weapon.
     */
    public IEnumerator Reload()
    {
        if (!IsAnimating && CurrentWeapon != null)
        {
            IsAnimating = true;
            // Debug.Log("Reloading...");
            animator.SetTrigger("Reload");
            aManager.PlaySound(AudioManager.SoundEffect.Reload);
            yield return(new WaitForSeconds(CurrentWeapon.ReloadTime));

            CurrentWeapon.Reload();
            IsAnimating = false;
            // Debug.Log("Done reloading!");
        }
    }
Beispiel #6
0
    private IEnumerator ReloadCoroutine()
    {
        IsReloading = true;

        float reloadProgress = 0;

        while (reloadProgress < CurrentWeapon.reloadTime)
        {
            reloadProgress += Time.deltaTime;
            ReloadProgress  = reloadProgress / CurrentWeapon.reloadTime;
            yield return(null);
        }

        CurrentWeapon.Reload();

        IsReloading = false;
    }
Beispiel #7
0
    void InputController_OnButtonDown(Action button, InputController controller)
    {
        if (CanAttack && !IsDead)
        {
            switch (button)
            {
            case Action.Start:
                if (controller.Controller != ControllerType.Keyboard)
                {
                    PauseMenu.Instance?.Pause(Player.InputController);
                }
                break;

            case Action.Cancel:
                if (controller.Controller == ControllerType.Keyboard)
                {
                    PauseMenu.Instance?.Pause(Player.InputController);
                }
                break;

            case Action.Shoot:
                if (CurrentWeapon)
                {
                    CurrentWeapon.Use(true);
                }
                break;

            case Action.Reload:
                if (CurrentWeapon)
                {
                    CurrentWeapon.Reload();
                }
                break;

            case Action.ChangeWeapon:
                ChangeWeapon();
                break;

            case Action.Melee:
                if (meleeWeapon)
                {
                    meleeWeapon.Use(true);
                }
                break;

            case Action.Ability:
                if (ability)
                {
                    ability.Use(this);
                }
                break;

            case Action.Heal:
                if (heal)
                {
                    heal.Use(this);
                }
                break;
            }
        }
    }