Пример #1
0
        private void CmdReloadPlayerWeapon()
        {
            NetworkedWeapon weapon = GetActiveWeapon();

            if (weapon.IsReloading)
            {
                return;
            }

            if (weapon.CurrentBulletAmount == weapon.GetTCWeapon().maxBullets)
            {
                return;
            }

            reloadingCoroutine = StartCoroutine(ServerReloadPlayerWeapon());
        }
Пример #2
0
        internal IEnumerator ServerReloadPlayerWeapon()
        {
            Logger.Debug($"Reloading player `{transform.name}`'s active weapon");

            //Get our players weapon
            NetworkedWeapon networkedWeapon = GetActiveWeapon();

            networkedWeapon.IsReloading         = true;
            networkedWeapon.CurrentBulletAmount = 0;

            TargetSendWeaponStatus(GetClientConnection, networkedWeapon);

            int weaponIndex = SelectedWeaponIndex;

            TCWeapon weapon = networkedWeapon.GetTCWeapon();

            yield return(new WaitForSeconds(weapon.reloadTime));

            FinishReload(networkedWeapon, weaponIndex);
        }