private void Shoot() { ShootingStop = false; _ShootRoutine.Start(ShootRoutine()); ShootingEvent?.Invoke(TargetPack); }
void HandleMouseInput() { var mouse = Mouse.current; if (mouse.leftButton.isPressed && player.Energy >= 1 && activeWeapon != null) { if (Mathf.Approximately(loadingShot, 0)) { ChargeEvent?.Invoke(); } loadingShot += 1f * Time.deltaTime; currentSpeed = 2f; } else if (mouse.leftButton.wasReleasedThisFrame) { if (loadingShot > 0.474f && player.Energy >= 1) { player.Energy -= 1; { var bulletDirection = GetCentralizedMousePos().normalized; activeWeapon.Shoot(bulletDirection); ShootingEvent?.Invoke(); velBooster = -bulletDirection * val; } } else { StopChargeEvent?.Invoke(); } currentSpeed = player.playerSpeed; loadingShot = 0f; } }
private void Shoot(ShootingEvent ev) { if (ev.Shooter.Inventory.GetItemInHand().durability == 2818 && ev.WeaponType == WeaponType.Epsilon11) { ev.Shooter.Inventory.items.ModifyDuration(ev.Shooter.Inventory.items.IndexOf(ev.Shooter.Inventory.GetItemInHand()), 2819); UserIDShooterDead = ev.Shooter.UserId; Vector3 pos = ev.Shooter.Position; MEC.Timing.RunCoroutine(Shoot2818(ev, pos), "TimingKillSCP2818"); } }
private IEnumerator <float> Shoot2818(ShootingEvent ev, Vector3 pos) { yield return(MEC.Timing.WaitForSeconds(0.1f)); ev.Shooter.Kill(DamageTypes.E11StandardRifle); yield return(MEC.Timing.WaitForSeconds(0.3f)); foreach (Ragdoll doll in UnityEngine.Object.FindObjectsOfType <Ragdoll>().Where(x => x.owner.PlayerId == ev.Shooter.Id && Vector3.Distance(x.transform.position, pos) < 2f)) { NetworkServer.Destroy(doll.gameObject); } yield return(MEC.Timing.WaitForSeconds(0.3f)); MEC.Timing.KillCoroutines("TimingKillSCP2818"); }