Esempio n. 1
0
        public OneTimeEvent(ModAnimationStateMachine animation, State state, OnAnimationEvent onAnimationEvent)
        {
            this.animation        = animation;
            this.state            = state;
            this.onAnimationEvent = onAnimationEvent;

            this.animation.stateChanged += OnStateChanged;
        }
Esempio n. 2
0
        public static void Prefix(vp_MuzzleFlash __instance, ref Transform tr)
        {
            PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
            ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

            if (animation != null)
            {
                tr = GameManager.GetVpFPSCamera().CurrentShooter.MuzzleFlash.transform.parent;
            }
        }
Esempio n. 3
0
            public static bool Prefix()
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                return(false);
            }
Esempio n. 4
0
            public static bool Prefix(ref bool __result)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                __result = animation.GetFirstPersonWeaponCanSwitch();
                return(false);
            }
Esempio n. 5
0
            public static bool Prefix(PlayerAnimation __instance, PlayerAnimation.State state, ref bool __result)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                __result = animation.CanTransitionTo(state);
                return(false);
            }
Esempio n. 6
0
            public static bool Prefix(OnAnimationEvent onAnimationComplete)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                animation.TransitionToAndFire(FromAiming, onAnimationComplete);
                return(false);
            }
Esempio n. 7
0
            public static bool Prefix(ref bool __result)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation == null)
                {
                    return(true);
                }

                __result = animation.IsAllowedToFire();
                return(false);
            }
Esempio n. 8
0
            public static bool Prefix()
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                animation.TransitionTo(Firing);
                GameManager.GetVpFPSCamera().AddForce2(0f, 0.25f, 0.25f);

                return(false);
            }
Esempio n. 9
0
        public static void Postfix(vp_FPSShooter __instance)
        {
            PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
            ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

            if (animation is null)
            {
                return;
            }

            if (__instance.MuzzleFlash != null)
            {
                __instance.MuzzleFlash.transform.localPosition = Vector3.zero;
            }
        }
Esempio n. 10
0
        private static void ConfigureRifle(ModComponent modComponent)
        {
            ModRifleComponent modRifleComponent = modComponent as ModRifleComponent;

            if (modRifleComponent == null)
            {
                return;
            }

            GunItem gunItem = ModUtils.GetOrCreateComponent <GunItem>(modRifleComponent);

            gunItem.m_GunType        = GunType.Rifle;
            gunItem.m_AmmoPrefab     = (GameObject)Resources.Load("GEAR_RifleAmmoSingle");
            gunItem.m_AmmoSpriteName = "ico_units_ammo";

            gunItem.m_AccuracyRange          = modRifleComponent.Range;
            gunItem.m_ClipSize               = modRifleComponent.ClipSize;
            gunItem.m_DamageHP               = modRifleComponent.DamagePerShot;
            gunItem.m_FiringRateSeconds      = modRifleComponent.FiringDelay;
            gunItem.m_MuzzleFlash_FlashDelay = modRifleComponent.MuzzleFlashDelay;
            gunItem.m_MuzzleFlash_SmokeDelay = modRifleComponent.MuzzleSmokeDelay;
            gunItem.m_ReloadCoolDownSeconds  = modRifleComponent.ReloadDelay;

            gunItem.m_DryFireAudio = "Play_RifleDryFire";
            gunItem.m_ImpactAudio  = "Play_BulletImpacts";

            gunItem.m_SwayIncreasePerSecond = modRifleComponent.SwayIncrement;
            gunItem.m_SwayValueZeroFatigue  = modRifleComponent.MinSway;
            gunItem.m_SwayValueMaxFatigue   = modRifleComponent.MaxSway;

            Cleanable cleanable = ModUtils.GetOrCreateComponent <Cleanable>(modRifleComponent);

            cleanable.m_ConditionIncreaseMin = 2;
            cleanable.m_ConditionIncreaseMin = 5;
            cleanable.m_DurationMinutesMin   = 15;
            cleanable.m_DurationMinutesMax   = 5;
            cleanable.m_CleanAudio           = "Play_RifleCleaning";
            cleanable.m_RequiresToolToClean  = true;
            cleanable.m_CleanToolChoices     = new ToolsItem[] { Resources.Load <GameObject>("GEAR_RifleCleaningKit").GetComponent <ToolsItem>() };

            FirstPersonItem firstPersonItem = ConfiguredRifleFirstPersonItem(modRifleComponent);

            ModAnimationStateMachine animation = ModUtils.GetOrCreateComponent <ModAnimationStateMachine>(modRifleComponent);

            animation.SetTransitions(firstPersonItem.m_PlayerStateTransitions);
        }
Esempio n. 11
0
            public static bool Prefix(float fatigue)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                var          camera        = GameManager.GetVpFPSCamera();
                vp_FPSWeapon currentWeapon = camera.CurrentWeapon;

                if (currentWeapon != null)
                {
                    currentWeapon.ShakeSpeed     = 0.5f;
                    currentWeapon.ShakeAmplitude = MAX_SHAKE_AMPLITUDE * fatigue;
                }

                return(false);
            }
Esempio n. 12
0
            public static bool Prefix(int bulletsToReload, OnAnimationEvent roundLoadedEventCallback, OnAnimationEvent clipLoadedEventCallback, OnAnimationEvent reloadCompleteEventCallback)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                ReloadProcess process = new ReloadProcess();

                process.remainingBullets            = bulletsToReload;
                process.reloadCompleteEventCallback = reloadCompleteEventCallback;
                process.roundLoadedEventCallback    = roundLoadedEventCallback;
                process.clipLoadedEventCallback     = clipLoadedEventCallback;
                process.animation = animation;
                process.Start();

                return(false);
            }