Beispiel #1
0
 // Token: 0x06005923 RID: 22819 RVA: 0x001EE864 File Offset: 0x001ECC64
 private void ConfigureAI()
 {
     if (this.AIMemory != null)
     {
         if (this.AIMemory.ItemExists("health"))
         {
             NpcMortality npcMortality = base.gameObject.AddComponent <NpcMortality>();
             npcMortality.memory = this.AIMemory;
         }
         if (this.AIMemory.ItemExists("attack"))
         {
             NpcAttack npcAttack = base.gameObject.AddComponent <NpcAttack>();
             npcAttack.damage = this.AIMemory.GetItem <int>("attack");
         }
     }
 }
Beispiel #2
0
 // 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);
             }
         }
     }
 }