Beispiel #1
0
 public void UpdateProxyRenderers()
 {
     if (this.ProxyRounds.Count > 0)
     {
         for (int i = 0; i < this.ProxyRounds.Count; i++)
         {
             this.ProxyRounds[i].Filter.mesh       = AM.GetRoundMesh(this.ProxyRounds[i].Type, this.ProxyRounds[i].Class);
             this.ProxyRounds[i].Renderer.material = AM.GetRoundMaterial(this.ProxyRounds[i].Type, this.ProxyRounds[i].Class);
         }
     }
 }
Beispiel #2
0
 public void AddRound(FVRFireArmRound round, bool makeSound, bool updateDisplay, bool animate)
 {
     if (this.m_numRounds < this.m_capacity)
     {
         this.m_timeSinceRoundInserted = 0f;
         patch_FVRLoadedRound fvrloadedRound = new patch_FVRLoadedRound();
         fvrloadedRound.LR_Class             = round.RoundClass;
         fvrloadedRound.LR_Type              = round.RoundType;
         fvrloadedRound.LR_Mesh              = AM.GetRoundMesh(round.RoundType, round.RoundClass);
         fvrloadedRound.LR_Material          = AM.GetRoundMaterial(round.RoundType, round.RoundClass);
         fvrloadedRound.LR_ObjectWrapper     = AM.GetRoundSelfPrefab(round.RoundType, round.RoundClass);
         this.LoadedRounds[this.m_numRounds] = fvrloadedRound;
         this.m_numRounds++;
         if (makeSound)
         {
             if (this.FireArm != null)
             {
                 if (this.m_numRounds >= this.m_capacity)
                 {
                     this.FireArm.PlayAudioEvent(FirearmAudioEventType.MagazineInsertRound, 0.8f);
                 }
                 else
                 {
                     this.FireArm.PlayAudioEvent(FirearmAudioEventType.MagazineInsertRound, 1f);
                 }
             }
             else if (this.m_numRounds >= this.m_capacity)
             {
                 SM.PlayCoreSoundOverrides(FVRPooledAudioType.Generic, this.Profile.MagazineInsertRound, base.transform.position, this.Profile.MagazineInsertRound.VolumeRange * 1f, this.Profile.MagazineInsertRound.PitchRange * 0.8f);
             }
             else
             {
                 SM.PlayCoreSound(FVRPooledAudioType.Generic, this.Profile.MagazineInsertRound, base.transform.position);
             }
         }
     }
     if (updateDisplay)
     {
         this.UpdateBulletDisplay();
     }
     if (animate && this.m_canAnimate)
     {
         this.DisplayBullets[0].transform.position = round.transform.position;
         this.DisplayBullets[0].transform.rotation = round.transform.rotation;
         this.m_roundInsertionStartPos             = round.transform.position;
         this.m_roundInsertionStartRot             = round.transform.rotation;
         this.m_roundInsertionLerp = 0f;
     }
 }
Beispiel #3
0
 public void AddRound(FireArmRoundClass rClass, bool makeSound, bool updateDisplay)
 {
     if (this.m_numRounds < this.m_capacity)
     {
         this.m_timeSinceRoundInserted = 0f;
         patch_FVRLoadedRound fvrloadedRound = new patch_FVRLoadedRound();
         fvrloadedRound.LR_Class             = rClass;
         fvrloadedRound.LR_Type              = this.RoundType;
         fvrloadedRound.LR_Mesh              = AM.GetRoundMesh(this.RoundType, rClass);
         fvrloadedRound.LR_Material          = AM.GetRoundMaterial(this.RoundType, rClass);
         fvrloadedRound.LR_ObjectWrapper     = AM.GetRoundSelfPrefab(this.RoundType, rClass);
         this.LoadedRounds[this.m_numRounds] = fvrloadedRound;
         this.m_numRounds++;
         if (makeSound)
         {
             if (this.FireArm != null)
             {
                 if (this.m_numRounds >= this.m_capacity)
                 {
                     this.FireArm.PlayAudioEvent(FirearmAudioEventType.MagazineInsertRound, 0.8f);
                 }
                 else
                 {
                     this.FireArm.PlayAudioEvent(FirearmAudioEventType.MagazineInsertRound, 1f);
                 }
             }
             else if (this.UsesOverrideInOut)
             {
                 SM.PlayGenericSound(this.ProfileOverride.MagazineInsertRound, base.transform.position);
             }
             else
             {
                 SM.PlayGenericSound(this.Profile.MagazineInsertRound, base.transform.position);
             }
         }
     }
     if (updateDisplay)
     {
         this.UpdateBulletDisplay();
     }
 }
Beispiel #4
0
 public void AddRound(FVRFireArmRound round, bool makeSound, bool updateDisplay)
 {
     if (this.m_numRounds < this.m_capacity)
     {
         this.m_timeSinceRoundInserted = 0f;
         FVRLoadedRound fvrloadedRound = new FVRLoadedRound();
         fvrloadedRound.LR_Class             = round.RoundClass;
         fvrloadedRound.LR_Type              = round.RoundType;
         fvrloadedRound.LR_Mesh              = AM.GetRoundMesh(round.RoundType, round.RoundClass);
         fvrloadedRound.LR_Material          = AM.GetRoundMaterial(round.RoundType, round.RoundClass);
         fvrloadedRound.LR_ObjectWrapper     = AM.GetRoundSelfPrefab(round.RoundType, round.RoundClass);
         this.LoadedRounds[this.m_numRounds] = fvrloadedRound;
         this.m_numRounds++;
         if (makeSound)
         {
             SM.PlayGenericSound(this.InsertOntoClip, base.transform.position);
         }
     }
     if (updateDisplay)
     {
         this.UpdateBulletDisplay();
     }
 }
        public static bool SpeedloaderChamber_LoadEmpty(SpeedloaderChamber __instance, FireArmRoundClass rclass, bool playSound = false)
        {
            __instance.IsLoaded    = true;
            __instance.IsSpent     = true;
            __instance.LoadedClass = rclass;

            if (AM.GetRoundSelfPrefab(__instance.Type, __instance.LoadedClass).GetGameObject().GetComponent <FVRFireArmRound>().FiredRenderer != null)
            {
                __instance.Filter.mesh             = AM.GetRoundSelfPrefab(__instance.Type, __instance.LoadedClass).GetGameObject().GetComponent <FVRFireArmRound>().FiredRenderer.gameObject.GetComponent <MeshFilter>().sharedMesh;
                __instance.LoadedRenderer.material = AM.GetRoundMaterial(__instance.Type, __instance.LoadedClass);
                __instance.LoadedRenderer.enabled  = true;
                if (playSound && __instance.SpeedLoader.ProfileOverride != null)
                {
                    SM.PlayGenericSound(__instance.SpeedLoader.ProfileOverride.MagazineInsertRound, __instance.transform.position);
                }
            }
            else
            {
                __instance.IsLoaded = false;
                __instance.LoadedRenderer.enabled = false;
            }

            return(false);
        }