private void GenerateAttackRPC(Vector3 pos, float radius, int damage, VRC.Player sender) { if (sender != base.Owner) { Debug.LogError("GenerateAttackRPC called by " + sender.name + " who is not the owner", this); return; } Vector3 position = VRCPlayer.Instance.transform.position; if (Vector3.Distance(position, pos) < radius) { PlayerModComponentHealth component = VRCPlayer.Instance.GetComponent <PlayerModComponentHealth>(); if (component != null) { component.RemoveHealth((float)damage); } } }
// Token: 0x060053E0 RID: 21472 RVA: 0x001CF2AC File Offset: 0x001CD6AC private void FireWeapon() { this.timeSinceShot = 0f; if (this.ClipContents == 0) { this.gunStats.muzzleAudio.PlayOneShot(this.gunStats.EmptyClipFire); this.gunStats.muzzleEffect.SetActive(false); this._animator.SetBool("Shooting", false); } else { this.ClipContents--; this.gunStats.muzzleAudio.PlayOneShot(this.gunStats.fireAudio[UnityEngine.Random.Range(0, this.gunStats.fireAudio.Length)]); this.gunStats.muzzleEffect.SetActive(true); this._animator.SetBool("Shooting", true); Ray ray = new Ray(this.gunInstance.transform.position, this.gunInstance.transform.forward); RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit)) { this.GenerateBulletHitEffect(raycastHit.point, this.gunInstance.transform.forward, raycastHit.normal); VRC.Network.RPC(VRC_EventHandler.VrcTargetType.Others, base.gameObject, "ShowWeaponFire", new object[] { raycastHit.point, this.gunInstance.transform.forward, raycastHit.normal }); PlayerModComponentHealth component = raycastHit.collider.GetComponent <PlayerModComponentHealth>(); if (component != null) { component.RemoveHealth(this.gunStats.damage); } NpcMortality componentInParent = raycastHit.collider.GetComponentInParent <NpcMortality>(); if (componentInParent != null) { componentInParent.ApplyDamage(this.gunStats.damage); } } } }
// Token: 0x060059EB RID: 23019 RVA: 0x001F3B68 File Offset: 0x001F1F68 private void Add(int instigatorPhotonId, bool isHealth) { PhotonView photonView = PhotonView.Find(instigatorPhotonId); if (photonView != null && photonView.isMine) { GameObject gameObject = photonView.gameObject; if (gameObject != null) { PlayerModComponentHealth component = gameObject.GetComponent <PlayerModComponentHealth>(); if (component != null) { if (this.healthBase != null) { component.AddHealth(this.healthBase.healthAmount); } if (this.damageBase != null) { component.RemoveHealth(this.damageBase.damageAmount); } } } } }