private void CmdReloadPlayerWeapon() { NetworkedWeapon weapon = GetActiveWeapon(); if (weapon.IsReloading) { return; } if (weapon.CurrentBulletAmount == weapon.GetTCWeapon().maxBullets) { return; } reloadingCoroutine = StartCoroutine(ServerReloadPlayerWeapon()); }
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); }