Пример #1
0
        public void AddFullAutoButton()
        {
            if ((detectedHandgun == null && detectedClosedBolt == null && detectedOpenBolt == null) || PanelCost > original.M.GetNumTokens())
            {
                //Debug.Log("Can't add full auto!");
                SM.PlayCoreSound(FVRPooledAudioType.UIChirp, original.AudEvent_Fail, transform.position);
                return;
            }

            else
            {
                //Debug.Log("Adding full auto!");
                SM.PlayCoreSound(FVRPooledAudioType.UIChirp, original.AudEvent_Spawn, transform.position);
                original.M.SubtractTokens(PanelCost);
                original.M.Increment(10, false);

                if (detectedHandgun != null)
                {
                    AddFullAutoToHandgun(detectedHandgun);
                    detectedHandgun = null;
                }

                else if (detectedClosedBolt != null)
                {
                    AddFullAutoToClosedBolt(detectedClosedBolt);
                    detectedClosedBolt = null;
                }

                else if (detectedOpenBolt != null)
                {
                    AddFullAutoToOpenBolt(detectedOpenBolt);
                    detectedOpenBolt = null;
                }
            }
        }
Пример #2
0
 public void Start()
 {
     _chamber = firearm switch
     {
         ClosedBoltWeapon weapon => weapon.Chamber,
         OpenBoltReceiver receiver => receiver.Chamber,
         Handgun handgun => handgun.Chamber,
                          _ => _chamber
     };
 }
Пример #3
0
        private void LoadFirearmProperties()
        {
            GameObject gunObject = GetGunObject().GetGameObject();

            Handgun handgunComp = gunObject.GetComponent <Handgun>();

            if (handgunComp != null)
            {
                foreach (Handgun.FireSelectorMode mode in handgunComp.FireSelectorModes)
                {
                    FireSelectorModes.Add(new FireSelectorMode(mode));
                }

                SpeedForward    = handgunComp.Slide.Speed_Forward;
                SpeedRearward   = handgunComp.Slide.Speed_Rearward;
                SpringStiffness = handgunComp.Slide.SpringStiffness;

                return;
            }

            ClosedBoltWeapon closedBoltComp = gunObject.GetComponent <ClosedBoltWeapon>();

            if (closedBoltComp != null)
            {
                foreach (ClosedBoltWeapon.FireSelectorMode mode in closedBoltComp.FireSelector_Modes)
                {
                    FireSelectorModes.Add(new FireSelectorMode(mode));
                }

                SpeedForward    = closedBoltComp.Bolt.Speed_Forward;
                SpeedRearward   = closedBoltComp.Bolt.Speed_Rearward;
                SpringStiffness = closedBoltComp.Bolt.SpringStiffness;

                return;
            }

            OpenBoltReceiver openBoltComp = gunObject.GetComponent <OpenBoltReceiver>();

            if (openBoltComp != null)
            {
                foreach (OpenBoltReceiver.FireSelectorMode mode in openBoltComp.FireSelector_Modes)
                {
                    FireSelectorModes.Add(new FireSelectorMode(mode));
                }

                SpeedForward    = openBoltComp.Bolt.BoltSpeed_Forward;
                SpeedRearward   = openBoltComp.Bolt.BoltSpeed_Rearward;
                SpringStiffness = openBoltComp.Bolt.BoltSpringStiffness;

                return;
            }
        }
Пример #4
0
 public void Start()
 {
     if (weapon is Handgun)
     {
         hg = weapon as Handgun;
     }
     if (weapon is ClosedBoltWeapon)
     {
         cbw = weapon as ClosedBoltWeapon;
     }
     if (weapon is Handgun)
     {
         obr = weapon as OpenBoltReceiver;
     }
 }
Пример #5
0
        private void Scan()
        {
            detectedHandgun    = null;
            detectedClosedBolt = null;
            detectedOpenBolt   = null;

            int colliderCount = Physics.OverlapBoxNonAlloc(original.ScanningVolume.position, original.ScanningVolume.localScale * 0.5f, colBuffer, original.ScanningVolume.rotation, original.ScanningLM, QueryTriggerInteraction.Collide);

            for (int i = 0; i < colliderCount; i++)
            {
                if (colBuffer[i].attachedRigidbody != null)
                {
                    Handgun handgun = colBuffer[i].GetComponent <Handgun>();
                    if (handgun != null)
                    {
                        if (handgun.FireSelectorModes == null || !handgun.FireSelectorModes.Any(o => o.ModeType == Handgun.FireSelectorModeType.FullAuto))
                        {
                            //Debug.Log("Hand gun detected!");
                            detectedHandgun = handgun;
                            return;
                        }
                    }

                    ClosedBoltWeapon closedBolt = colBuffer[i].GetComponent <ClosedBoltWeapon>();
                    if (closedBolt != null)
                    {
                        if (closedBolt.FireSelector_Modes == null || !closedBolt.FireSelector_Modes.Any(o => o.ModeType == ClosedBoltWeapon.FireSelectorModeType.FullAuto))
                        {
                            //Debug.Log("Closed bolt detected!");
                            detectedClosedBolt = closedBolt;
                            return;
                        }
                    }

                    OpenBoltReceiver openBolt = colBuffer[i].GetComponent <OpenBoltReceiver>();
                    if (openBolt != null)
                    {
                        if (openBolt.FireSelector_Modes == null || !openBolt.FireSelector_Modes.Any(o => o.ModeType == OpenBoltReceiver.FireSelectorModeType.FullAuto))
                        {
                            //Debug.Log("Open bolt detected!");
                            detectedOpenBolt = openBolt;
                            return;
                        }
                    }
                }
            }
        }
Пример #6
0
        public void DecreaseFireRateButton()
        {
            if ((detectedHandgun == null && detectedClosedBolt == null && detectedOpenBolt == null) || PanelCost > original.M.GetNumTokens())
            {
                SM.PlayCoreSound(FVRPooledAudioType.UIChirp, original.AudEvent_Fail, transform.position);
                return;
            }

            else
            {
                SM.PlayCoreSound(FVRPooledAudioType.UIChirp, original.AudEvent_Spawn, transform.position);
                original.M.SubtractTokens(PanelCost);
                original.M.Increment(10, false);

                DecreaseFireRate();
                detectedHandgun    = null;
                detectedOpenBolt   = null;
                detectedClosedBolt = null;
            }
        }
Пример #7
0
        private void AddFullAutoToOpenBolt(OpenBoltReceiver gun)
        {
            OpenBoltReceiver.FireSelectorMode fullAuto = new OpenBoltReceiver.FireSelectorMode();
            fullAuto.ModeType         = OpenBoltReceiver.FireSelectorModeType.FullAuto;
            fullAuto.SelectorPosition = 0;

            if (gun.FireSelector_Modes == null || gun.FireSelector_Modes.Length == 0)
            {
                //Debug.Log("Gun did not have fire selector, adding full");

                OpenBoltReceiver.FireSelectorMode single = new OpenBoltReceiver.FireSelectorMode();
                single.ModeType         = OpenBoltReceiver.FireSelectorModeType.Single;
                single.SelectorPosition = 0;

                gun.FireSelector_Modes = new OpenBoltReceiver.FireSelectorMode[] { single, fullAuto };
            }
            else
            {
                //Debug.Log("Gun had fire selector, adding full");
                List <OpenBoltReceiver.FireSelectorMode> modes = new List <OpenBoltReceiver.FireSelectorMode>(gun.FireSelector_Modes);
                modes.Add(fullAuto);
                gun.FireSelector_Modes = modes.ToArray();
            }
        }
Пример #8
0
        public void RefreshObjectControls(FVRPhysicalObject obj)
        {
            if (Object != null)
            {
                CleanupHeldObject();
            }

            Object = obj;

            m_columnStarts = new int[] { 0, 0, 0 };

            if (Object != null)
            {
                if (Panel != null && Panel.PageNameText != null && Object.ObjectWrapper != null)
                {
                    Panel.PageNameText.text = PageTitle + " - " + Object.ObjectWrapper.DisplayName;
                }

                m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], Object, new string[] { "SpawnLockable", "Harnessable", "Size", "QBSlotType", "ThrowVelMultiplier", "ThrowAngMultiplier", "UsesGravity", "DoesQuickbeltSlotFollowHead", "DistantGrabbable", "IsPickUpLocked", "UseGripRotInterp" });
                m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], Object, new string[] { "ToggleKinematicLocked" }, null, null, new bool[] { true });

                if (Object.GetComponentInChildren <FVRFireArmMagazine>() != null)
                {
                    m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], Object.GetComponentInChildren <FVRFireArmMagazine>(), new string[] { "m_capacity", "IsInfinite", "MagazineType", "RoundType", "FuelAmountLeft", "CanManuallyEjectRounds" });
                }
                if (Object.GetComponentInChildren <FVRFireArmClip>() != null)
                {
                    m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], Object.GetComponentInChildren <FVRFireArmClip>(), new string[] { "m_capacity", "IsInfinite", "ClipType", "RoundType", "CanManuallyEjectRounds" });
                }

#if !UNITY_EDITOR && !UNITY_STANDALONE
                if (Object.GetComponent <FVRFireArm>() != null)
                {
                    m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0] + 1, Object.GetComponent <FVRFireArm>(), new string[] { "MagazineType", "ClipType", "RoundType" });
                    if (m_curChamber == null)
                    {
                        TryToGetCurrentChamber();
                    }

                    if (AccessTools.Field(Object.GetType(), "Chamber") != null)
                    {
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetType().GetField("Chamber").GetValue(Object), new string[] { "RoundType", "ChamberVelocityMultiplier", "IsManuallyExtractable" });
                    }
                    else if (AccessTools.Field(Object.GetType(), "m_curChamber") != null)
                    {
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], m_curChamber, new string[] { "RoundType", "ChamberVelocityMultiplier", "IsManuallyExtractable" }, null, new bool[] { true, true, true });
                    }

                    if (Object.GetComponent <Handgun>() != null)
                    {
                        Handgun handgun = Object.GetComponent <Handgun>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, handgun, new string[] { "HasManualDecocker", "HasMagReleaseInput", "CanPhysicsSlideRack" });
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, handgun.Slide, new string[] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundSlideHoldOpen" });
                        AddObjectControls(Columns[2], 14, handgun.FireSelectorModes[handgun.FireSelectorModeIndex], new string[] { "ModeType", "BurstAmount" });
                    }

                    else if (Object.GetComponent <OpenBoltReceiver>() != null)
                    {
                        OpenBoltReceiver obr = Object.GetComponent <OpenBoltReceiver>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, obr, new string[] { "HasMagReleaseButton" });
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, obr.Bolt, new string[] { "BoltSpeed_Forward", "BoltSpeed_Rearward", "BoltSpeed_Held", "BoltSpringStiffness", "HasLastRoundBoltHoldOpen", "BoltRot_Standard", "BoltRot_Safe", "BoltRot_SlipDistance" });
                        AddObjectControls(Columns[2], 14, obr.FireSelector_Modes[obr.FireSelectorModeIndex], new string[] { "ModeType" });
                        AddObjectControls(Columns[2], 15, obr, new string[] { "SuperBurstAmount" });
                    }

                    else if (Object.GetComponent <ClosedBoltWeapon>() != null)
                    {
                        ClosedBoltWeapon cbw = Object.GetComponent <ClosedBoltWeapon>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, cbw, new string[] { "EjectsMagazineOnEmpty", "BoltLocksWhenNoMagazineFound", "DoesClipEntryRequireBoltBack", "HasMagReleaseButton" });
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, cbw.Bolt, new string[] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundBoltHoldOpen", "UsesAKSafetyLock", "DoesClipHoldBoltOpen" });
                        AddObjectControls(Columns[2], 14, cbw.FireSelector_Modes[cbw.FireSelectorModeIndex], new string[] { "ModeType", "BurstAmount" });
                    }

                    else if (Object.GetComponent <BreakActionWeapon>() != null)
                    {
                        BreakActionWeapon baw = Object.GetComponent <BreakActionWeapon>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], baw, new string[] { "m_isLatched", "UsesManuallyCockedHammers", "FireAllBarrels", "PopOutEmpties" });
                        for (int i = 0; i < baw.Barrels.Length; i++)
                        {
                            m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], baw.Barrels[i].Chamber, new string[] { "RoundType", "ChamberVelocityMultiplier", "SpreadRangeModifier" });
                        }
                    }

                    else if (Object.GetComponent <TubeFedShotgun>() != null)
                    {
                        TubeFedShotgun tfs = Object.GetComponent <TubeFedShotgun>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, tfs, new string[] { "m_isHammerCocked", "UsesSlamFireTrigger", "CanModeSwitch" });
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, tfs.Bolt, new string[] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundBoltHoldOpen" });
                        if (tfs.Handle != null)
                        {
                            m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2] + 1, tfs.Handle, new string[] { "Speed_Held", "m_isHandleLocked" });
                        }
                    }

                    else if (Object.GetComponent <Flaregun>() != null)
                    {
                        Flaregun flaregun = Object.GetComponent <Flaregun>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, flaregun, new string[] { "HingeAxis", "RotOut", "CanUnlatch", "IsHighPressureTolerant", "m_isHammerCocked", "m_isDestroyed", "CocksOnOpen" });
                    }

                    else if (Object.GetComponent <SimpleLauncher>() != null)
                    {
                        SimpleLauncher sl = Object.GetComponent <SimpleLauncher>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, sl, new string[] { "HasTrigger", "AlsoPlaysSuppressedSound", "DeletesCartridgeOnFire", "FireOnCol", "ColThresh" });
                    }

                    else if (Object.GetComponent <BoltActionRifle>() != null)
                    {
                        BoltActionRifle bar = Object.GetComponent <BoltActionRifle>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, bar, new string[] { "HasMagEjectionButton", "m_isHammerCocked", "EjectsMagazineOnEmpty", "HasMagEjectionButton" });
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, bar.BoltHandle, new string[] { "UsesQuickRelease", "BaseRotOffset", "MinRot", "MaxRot", "UnlockThreshold" });
                    }

                    else if (Object.GetComponent <Revolver>() != null)
                    {
                        Revolver revolver = Object.GetComponent <Revolver>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, revolver, new string[] { "CanManuallyCockHammer", "m_isHammerLocked", "m_isCylinderArmLocked", "CylinderRotRange", "IsCylinderArmZ", "GravityRotsCylinderPositive" });
                    }

                    else if (Object.GetComponent <LAPD2019>() != null)
                    {
                        LAPD2019 lapd = Object.GetComponent <LAPD2019>();
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, lapd, new string[] { "m_isCylinderArmLocked", "CylinderRotRange", "GravityRotsCylinderPositive", "m_isAutoChargeEnabled", "m_hasBattery", "m_batteryCharge", "m_hasThermalClip", "m_heatThermalClip", "m_heatSystem", "m_barrelHeatDamage" });
                        m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], lapd.BoltHandle, new string[] { "UsesQuickRelease", "BaseRotOffset", "MinRot", "MaxRot", "UnlockThreshold" });
                    }

                    m_curChamberIndex = 0;
                }

                else if (Object.GetComponent <FVRFireArmRound>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <FVRFireArmRound>(), new string[] { "RoundType", "RoundClass", "IsHighPressure", "NumProjectiles", "ProjectileSpread", "IsDestroyedAfterCounter", "m_isKillCounting", "isCookingOff", "isManuallyChamberable", "IsCaseless", "isMagazineLoadable", "isPalmable", "MaxPalmedAmount" });
                }

                else if (Object.GetComponent <FVRGrenade>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <FVRGrenade>(), new string[] { "DefaultFuse" });
                }

                else if (Object.GetComponent <MF2_Medigun>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <MF2_Medigun>(), new string[] { "EngageRange", "MaxRange", "TryEngageBeam", "EngageUber", "DisEngageBeam", "m_uberChargeUp", "m_uberChargeOut" });
                }

                else if (Object.GetComponent <SosigLink>() != null)
                {
                    SosigLink L = Object.GetComponent <SosigLink>();
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], L.S, new string[] { "ClearSosig", "", "BodyState", "CurrentOrder", "Mustard", "BleedDamageMult", "BleedRateMult", "Speed_Crawl", "Speed_Sneak", "Speed_Walk", "Speed_Run" });
                    m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], L, new string[] { "m_integrity", "StaggerMagnitude", "DamMult" });
                }

                else if (Object.GetComponent <SosigWeaponPlayerInterface>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <SosigWeaponPlayerInterface>().W, new string[] { "CycleSpeedForward", "CycleSpeedBackward", "ShotsPerLoad", "m_shotsLeft", "ProjectilesPerShot", "ProjectileSpread", "isFullAuto", "ReloadTime", "BurstLimit" });
                }

                else if (Object.GetComponent <RW_Powerup>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <RW_Powerup>(), new string[] { "PowerupType", "PowerupIntensity", "PowerupDuration", "PowerUpSpecial", "Cooked", "UpdateSymbols" });
                }

                else if (Object.GetComponent <ShatterablePhysicalObject>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <ShatterablePhysicalObject>(), new string[] { "currentToughness", "TransfersVelocityExplosively", "DamageReceivedMultiplier", "CollisionShatterThreshold" });
                }

                else if (Object.GetComponent <RotrwBangerJunk>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <RotrwBangerJunk>(), new string[] { "Type", "ContainerSize" });
                }

                else if (Object.GetComponent <Banger>() != null)
                {
                    Banger banger = Object.GetComponent <Banger>();
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], banger, new string[] { "BType", "BSize", "m_isArmed", "m_timeToPayload", "ProxRange", "m_timeSinceArmed", "m_shrapnelVel", "m_isSticky", "m_isSilent", "m_isHoming", "m_canbeshot", "SetToBouncy" });

                    if (banger.BDial != null)
                    {
                        m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], banger.BDial, new string[] { "DialTick", "m_isPrimed", "m_hasDinged" });
                    }
                }

                else if (Object.GetComponent <BangerDetonator>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <BangerDetonator>(), new string[] { "TriggerRange", "Detonate" });
                }

                else if (Object.GetComponent <GronchHatCase>() != null)
                {
                    m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], Object.GetComponent <GronchHatCase>(), new string[] { "m_isOpen", "Open", "HID" }, null, null, new bool[] { false, true, false }, new object[][] { null, new object[] { new GameObject("dummy").AddComponent <GronchHatCaseKey>() }, null });
                }
#endif
            }
        }
Пример #9
0
        public void BoltSpeedModifier(actionType ActType)
        {
            int wepType = 0;
            OpenBoltReceiver _OpenBoltWep   = null;
            ClosedBoltWeapon _ClosedBoltWep = null;
            Handgun          _HandgunWep    = null;
            TubeFedShotgun   _TFWep         = null;

            if (weapon is OpenBoltReceiver)
            {
                _OpenBoltWep = weapon as OpenBoltReceiver;
                wepType      = 1;
            }
            else if (weapon is ClosedBoltWeapon)
            {
                _ClosedBoltWep = weapon as ClosedBoltWeapon;
                wepType        = 2;
            }
            else if (weapon is Handgun)
            {
                _HandgunWep = weapon as Handgun;
                wepType     = 3;
            }
            else if (weapon is TubeFedShotgun)
            {
                _TFWep  = weapon as TubeFedShotgun;
                wepType = 4;
            }

            float _boltSpeedBack       = 0;
            float _boltSpeedForward    = 0;
            float _boltSpringStiffness = 0;

            switch (wepType)
            {
            case 1:
                _boltSpeedBack       = _OpenBoltWep.Bolt.BoltSpeed_Rearward;
                _boltSpeedForward    = _OpenBoltWep.Bolt.BoltSpeed_Forward;
                _boltSpringStiffness = _OpenBoltWep.Bolt.BoltSpringStiffness;
                break;

            case 2:
                _boltSpeedBack       = _ClosedBoltWep.Bolt.Speed_Rearward;
                _boltSpeedForward    = _ClosedBoltWep.Bolt.Speed_Forward;
                _boltSpringStiffness = _ClosedBoltWep.Bolt.SpringStiffness;
                break;

            case 3:
                _boltSpeedBack       = _HandgunWep.Slide.Speed_Forward;
                _boltSpeedForward    = _HandgunWep.Slide.Speed_Rearward;
                _boltSpringStiffness = _HandgunWep.Slide.SpringStiffness;
                break;
            }

            if (ActType == actionType.attach)
            {
                prevBoltSpeedBackwards  = _boltSpeedBack;
                prevBoltSpeedForward    = _boltSpeedForward;
                prevBoltSpringStiffness = _boltSpringStiffness;

                if (BoltSpeedModifierType == CapType.SetTo)
                {
                    _boltSpeedBack       = BoltSpeedBackwards;
                    _boltSpeedForward    = BoltSpeedForward;
                    _boltSpringStiffness = BoltSpringStiffness;
                }
                if (BoltSpeedModifierType == CapType.AddTo)
                {
                    _boltSpeedBack       += BoltSpeedBackwards;
                    _boltSpeedForward    += BoltSpeedForward;
                    _boltSpringStiffness += BoltSpringStiffness;
                }
            }
            if (ActType == actionType.detach)
            {
                _boltSpeedBack       = prevBoltSpeedBackwards;
                _boltSpeedForward    = prevBoltSpeedForward;
                _boltSpringStiffness = prevBoltSpringStiffness;
            }

            if (ChangesBoltSpeedRearward)
            {
                switch (wepType)
                {
                case 1:
                    _OpenBoltWep.Bolt.BoltSpeed_Rearward = _boltSpeedBack;
                    break;

                case 2:
                    _ClosedBoltWep.Bolt.Speed_Rearward = _boltSpeedBack;
                    break;

                case 3:
                    _HandgunWep.Slide.Speed_Forward = _boltSpeedBack;
                    break;
                }
            }
            if (ChangesBoltSpeedForward)
            {
                switch (wepType)
                {
                case 1:
                    _OpenBoltWep.Bolt.BoltSpeed_Forward = _boltSpeedForward;
                    break;

                case 2:
                    _ClosedBoltWep.Bolt.Speed_Forward = _boltSpeedForward;
                    break;

                case 3:
                    _HandgunWep.Slide.Speed_Rearward = _boltSpeedForward;
                    break;
                }
            }
            if (ChangesBoltSpeedStiffness)
            {
                switch (wepType)
                {
                case 1:
                    _OpenBoltWep.Bolt.BoltSpringStiffness = _boltSpringStiffness;
                    break;

                case 2:
                    _ClosedBoltWep.Bolt.SpringStiffness = _boltSpringStiffness;
                    break;

                case 3:
                    _HandgunWep.Slide.SpringStiffness = _boltSpringStiffness;
                    break;
                }
            }
        }
Пример #10
0
        public void ApplyFirearmProperties(FVRFireArm firearm)
        {
            if (!OverrideFireRate && !OverrideFireSelectors)
            {
                return;
            }

            Handgun handgunComp = firearm.gameObject.GetComponent <Handgun>();

            if (handgunComp != null)
            {
                if (OverrideFireSelectors)
                {
                    List <Handgun.FireSelectorMode> modeList = new List <Handgun.FireSelectorMode>();
                    foreach (FireSelectorMode mode in FireSelectorModes)
                    {
                        modeList.Add(mode.GetHandgunMode());
                    }
                    handgunComp.FireSelectorModes = modeList.ToArray();
                }

                if (OverrideFireRate)
                {
                    handgunComp.Slide.Speed_Forward   = SpeedForward;
                    handgunComp.Slide.Speed_Rearward  = SpeedRearward;
                    handgunComp.Slide.SpringStiffness = SpringStiffness;
                }

                return;
            }

            ClosedBoltWeapon closedBoltComp = firearm.gameObject.GetComponent <ClosedBoltWeapon>();

            if (closedBoltComp != null)
            {
                if (OverrideFireSelectors)
                {
                    List <ClosedBoltWeapon.FireSelectorMode> modeList = new List <ClosedBoltWeapon.FireSelectorMode>();
                    foreach (FireSelectorMode mode in FireSelectorModes)
                    {
                        modeList.Add(mode.GetClosedBoltMode());
                    }
                    closedBoltComp.FireSelector_Modes = modeList.ToArray();
                }

                if (OverrideFireRate)
                {
                    closedBoltComp.Bolt.Speed_Forward   = SpeedForward;
                    closedBoltComp.Bolt.Speed_Rearward  = SpeedRearward;
                    closedBoltComp.Bolt.SpringStiffness = SpringStiffness;
                }

                return;
            }

            OpenBoltReceiver openBoltComp = firearm.gameObject.GetComponent <OpenBoltReceiver>();

            if (openBoltComp != null)
            {
                if (OverrideFireSelectors)
                {
                    List <OpenBoltReceiver.FireSelectorMode> modeList = new List <OpenBoltReceiver.FireSelectorMode>();
                    foreach (FireSelectorMode mode in FireSelectorModes)
                    {
                        modeList.Add(mode.GetOpenBoltMode());
                    }
                    openBoltComp.FireSelector_Modes = modeList.ToArray();
                }

                if (OverrideFireRate)
                {
                    openBoltComp.Bolt.BoltSpeed_Forward   = SpeedForward;
                    openBoltComp.Bolt.BoltSpeed_Rearward  = SpeedRearward;
                    openBoltComp.Bolt.BoltSpringStiffness = SpringStiffness;
                }

                return;
            }
        }