Esempio n. 1
0
        private void Awake()
        {
            Instance = this;

            PlayerDataLocal = GetComponent <PlayerDataLocal>();

            var events = PlayerDataLocal.Events_;

            // events.Subscribe<AbilityStateChanged.Data>(OnAbilityStateChanged);
            events.Subscribe <CarInstantiate.Data>(OnCarInstantiate);

            gameObject.AddComponent <Hotkeys>();
        }
Esempio n. 2
0
        /*
         * TODO:
         * This breaks when the player leaves for the main menu as the car object is destroyed.
         * Possible to maybe hook into 'StoryIntroCutsceneLogic', which is responsible for spawning the car.
         */

        private void OnEnable()
        {
            Util.Logger.Instance.Log("[HealthHack-OnEnable] - OnEnable, hooking events");

            this.playerData_ = G.Sys.PlayerManager_.Current_.playerData_;
            if (this.playerData_ == null)
            {
                Util.Logger.Instance.Log("[HealthHack-OnEnable] playerData is null, cannot keep going!");
                return;
            }

            this.playerEvents_ = this.playerData_.Events_;
            this.playerEvents_.SubscribeToCarInstantiateHelper(new InstancedEvent <CarInstantiate.Data> .Delegate(this.OnPlayerEventCarInstantiate));
            this.playerEvents_.Subscribe <Impact.Data>(new InstancedEvent <Impact.Data> .Delegate(this.OnCarEventImpact));
            this.playerEvents_.Subscribe <Death.Data>(new InstancedEvent <Death.Data> .Delegate(this.OnCarEventDeath));
            this.playerEvents_.Subscribe <Split.Data>(new InstancedEvent <Split.Data> .Delegate(this.OnCarEventSplit));
        }
Esempio n. 3
0
        public static bool Prefix(AdventureMode __instance)
        {
            string path = Utils.Common.LevelFile;

            __instance.UpdateRaceModeDistanceToFinish();
            if (__instance.hasEnded_ || __instance.GetDisplayTime(0) > 0.0 || __instance.campaignPlusEnabled_)
            {
                return(false);
            }
            __instance.hasEnded_ = true;

            bool flag_a = Utils.Campaign.IsCustomCampaignLevel(path) && Utils.Campaign.GetLevelCountdown(path) > 0;

            flag_a |= !Utils.Campaign.IsCustomCampaignLevel(path);

            if (!__instance.countdownDisabled_ && flag_a)
            {
                int             currentPlaylistIndex = __instance.gameMan_.GetCurrentPlaylistIndex();
                PlayerDataLocal firstLocalPlayer     = PlayerDataLocal.FirstLocalPlayer_;

                bool flag_b = !Utils.Campaign.IsCustomCampaignLevel(path) && (currentPlaylistIndex == 0 || currentPlaylistIndex == __instance.gameMan_.LevelPlaylist_.Count_ - 1);

                if (flag_b || __instance.HasFinished(firstLocalPlayer) || firstLocalPlayer is null || (firstLocalPlayer.Car_ is null || __instance.finishTriggerObj_ is null))
                {
                    return(false);
                }
                __instance.finishTriggerObj_.transform.position = firstLocalPlayer.Car_.transform.position;
                __instance.finishTriggerObj_.SetActive(true);
            }
            else
            {
                StaticEvent <ZEvent.Data> .Broadcast(new ZEvent.Data("AdventureModeClockHitZero", true));
            }

            return(false);
        }
Esempio n. 4
0
 private static void Postfix(PlayerDataLocal __instance) =>
 __instance.gameObject.AddComponent <Cheats>();