コード例 #1
0
        public static void Postfix(VacDisplayChanger __instance)
        {
            Console.Log("Awake with Vacpack enum: " + Values.VACPACK);
            bool flag = __instance.playerState.HasUpgrade(Ids.MOCHI_HACK);

            if (flag)
            {
                VACPACK_ENUMS flag1 = Values.VACPACK;
                switch (flag1)
                {
                case VACPACK_ENUMS.NIMBLE_VALLEY:
                    __instance.SetDisplayMode(PlayerState.AmmoMode.NIMBLE_VALLEY);
                    break;

                case VACPACK_ENUMS.DEFAULT:
                    __instance.SetDisplayMode(PlayerState.AmmoMode.DEFAULT);
                    break;

                case VACPACK_ENUMS.AUTOMATIC:
                    ZoneDirector.Zone currentZone = SRSingleton <SceneContext> .Instance.PlayerZoneTracker.GetCurrentZone();

                    PlayerState.AmmoMode ammoMode = (currentZone == ZoneDirector.Zone.MOCHI_RANCH || currentZone == ZoneDirector.Zone.VALLEY)
                            ? PlayerState.AmmoMode.NIMBLE_VALLEY :
                                                    PlayerState.AmmoMode.DEFAULT;
                    __instance.SetDisplayMode(ammoMode);
                    break;
                }
            }
        }
コード例 #2
0
        public void OnGUI()
        {
            if (!DebugCommand.DebugMode)
            {
                return;
            }

            GUILayout.BeginArea(new Rect(15, 200, 450, Screen.height - 400));

            // Title
            GUILayout.Label("<b>DEBUG MODE ACTIVE</b>");
            GUILayout.Space(5);

            // SCENE CONTEXT STUFF
            if (SceneManager.GetActiveScene().name.Equals("worldGenerated"))
            {
                // Vars
                ZoneDirector.Zone zone = SceneContext.Instance.PlayerZoneTracker.GetCurrentZone();

                // Player Info
                GUILayout.Label($"<b>Position: </b>{SceneContext.Instance.Player.transform.position}");
                GUILayout.Label($"<b>Zone: </b>{zone}");
                GUILayout.Label($"<b>Map Unlocked: </b>{SceneContext.Instance.PlayerState.HasUnlockedMap(zone)}");
                GUILayout.Label($"<b>EndGame Time: </b>{SceneContext.Instance.PlayerState.GetEndGameTime()}");
                GUILayout.Label($"<b>Ammo Mode: </b>{SceneContext.Instance.PlayerState.GetAmmoMode()}");
                GUILayout.Space(5);

                // View Raycast
                GUILayout.Label($"<b>Look At: </b>{mainHit.point}");
                GUILayout.Label($"<b>Object: </b>{mainHit.collider?.name ?? "null"}");
                GUILayout.Label($"<b>Parent: </b>{mainHit.collider?.transform.parent.name ?? "null"}");
            }

            GUILayout.EndArea();
        }
コード例 #3
0
        // Injects the mutations into the spanwers
        private static void AddMutations(DirectedActorSpawner spawn)
        {
            ZoneDirector.Zone zone = spawn.GetComponentInParent <Region>().GetZoneId();

            foreach (DirectedActorSpawner.SpawnConstraint constraint in spawn.constraints)
            {
                foreach (Identifiable.Id id in MUTATIONS.Keys)
                {
                    if (MUTATIONS[id].Item1 != ZoneDirector.Zone.NONE && zone != MUTATIONS[id].Item1)
                    {
                        continue;
                    }

                    SlimeSet.Member slime = constraint.slimeset.members
                                            .FirstOrDefault(member => member.prefab.GetComponent <Identifiable>().id == id);

                    if (slime == null)
                    {
                        continue;
                    }

                    List <SlimeSet.Member> members = new List <SlimeSet.Member>(constraint.slimeset.members)
                    {
                        new SlimeSet.Member
                        {
                            prefab = GameContext.Instance.LookupDirector.GetPrefab(MUTATIONS[id].Item2),
                            weight = slime.weight / 3
                        }
                    };

                    constraint.slimeset.members = members.ToArray();
                }
            }
        }
コード例 #4
0
        // The legacy GUI to display generic debug info
        private void OnGUI()
        {
            if (!IsDebugging)
            {
                return;
            }

            GUILayout.BeginArea(new Rect(15, 200, 450, Screen.height - 400));

            // Title
            GUILayout.Label("<b>DEBUG MODE ACTIVE</b>");
            GUILayout.Space(5);

            // Vars
            ZoneDirector.Zone zone = SceneContext.Instance.PlayerZoneTracker.GetCurrentZone();

            // Player Info
            GUILayout.Label($"<b>Position: </b>{SceneContext.Instance.Player.transform.position}");
            GUILayout.Label($"<b>Zone: </b>{zone}");
            GUILayout.Label($"<b>Map Unlocked: </b>{SceneContext.Instance.PlayerState.HasUnlockedMap(zone)}");
            GUILayout.Label($"<b>EndGame Time: </b>{SceneContext.Instance.PlayerState.GetEndGameTime()}");
            GUILayout.Label($"<b>Ammo Mode: </b>{SceneContext.Instance.PlayerState.GetAmmoMode()}");
            GUILayout.Space(5);

            // View Raycast
            GUILayout.Label($"<b>Look At: </b>{mainHit.point}");

            GUILayout.EndArea();
        }
コード例 #5
0
        // Triggers when you enter a zone
        internal static void OnZoneEntered(ZoneDirector.Zone zone, PlayerState player)
        {
            if (!isInitialized)
            {
                return;
            }

            ZoneEnter?.Invoke(zone, player);
        }
コード例 #6
0
ファイル: DebugSystem.cs プロジェクト: Lionmeow/SRML
        public void OnGUI()
        {
            if (!DebugCommand.DebugMode)
            {
                return;
            }

            GUILayout.BeginArea(new Rect(15, 250, 450, Screen.height - 400));

            // Title
            GUILayout.Label("<b>DEBUG MODE ACTIVE</b>");
            GUILayout.Space(5);

            // SCENE CONTEXT STUFF
            if (SceneManager.GetActiveScene().name.Equals("worldGenerated"))
            {
                // Vars
                ZoneDirector.Zone zone = SceneContext.Instance.PlayerZoneTracker.GetCurrentZone();
                bool mainHitNull       = mainHit.Equals(default(RaycastHit));

                // Player Info
                GUILayout.Label($"<size=20><b>Player Info:</b></size>");
                GUILayout.Space(3);
                GUILayout.Label($"<b>Position: </b>{SceneContext.Instance.Player.transform.position}");
                GUILayout.Label($"<b>Zone: </b>{zone}");
                GUILayout.Label($"<b>Map Unlocked: </b>{SceneContext.Instance.PlayerState.HasUnlockedMap(zone)}");
                GUILayout.Label($"<b>EndGame Time: </b>{SceneContext.Instance.PlayerState.GetEndGameTime()}");
                GUILayout.Label($"<b>Ammo Mode: </b>{SceneContext.Instance.PlayerState.GetAmmoMode()}");
                GUILayout.Label($"<b>Look At: </b>" + (mainHitNull ? "None" : $"{mainHit.point}"));
                GUILayout.Space(20);
                if (!mainHitNull)
                {
                    // Object Panel
                    GUILayout.Label($"<size=20><b>Object Inspector:</b></size>");
                    GUILayout.Space(3);
                    GUILayout.Label($"<b>Path: </b>{GetPath(mainHit.collider?.transform)}");
                    GUILayout.Label($"<b>Position: </b>{mainHit.collider?.transform.position}");
                    GUILayout.Label($"<b>Rotation: </b>{mainHit.collider?.transform.rotation}");
                    GUILayout.Label($"<b>Scale: </b>{mainHit.collider?.transform.localScale}");
                    Identifiable.Id id = Identifiable.GetId(mainHit.collider.gameObject);
                    if (id != Identifiable.Id.NONE)
                    {
                        GUILayout.Label($"<b>Identifiable.Id: </b>{id}");
                    }
                }
            }

            GUILayout.EndArea();
        }
コード例 #7
0
        /// <summary>
        /// Registers a new area cell
        /// </summary>
        /// <param name="zone">The zone to add this cell to</param>
        /// <param name="pos">The position to spawn the area in</param>
        /// <param name="cellArea">The area to spawn</param>
        /// <param name="spawn">The action to run for each marker after spawn</param>
        /// <param name="cell">The action to run when building each Cell Director</param>
        /// <returns>The area cell registered</returns>
        public static AreaCell RegisterAreaCell(ZoneDirector.Zone zone, Vector3 pos, GameObject cellArea, Action <GameObject> spawn, Action <CellDirector, Region> cell)
        {
            AreaCell item = new AreaCell()
            {
                zone        = zone,
                position    = pos,
                cell        = cellArea,
                spawnAction = spawn,
                cellSetup   = cell
            };

            AreaCells.Add(item);

            return(item);
        }
コード例 #8
0
        /// <summary>
        /// Registers new area cell content
        /// </summary>
        /// <param name="zone">The zone to add this cell to</param>
        /// <param name="objName">The name of the cell to add to</param>
        /// <param name="pos">The position to spawn the area in</param>
        /// <param name="contentArea">The area to spawn</param>
        /// <param name="spawn">The action to run for each marker after spawn</param>
        /// <returns>The area cell content registered</returns>
        public static AreaCellContent RegisterAreaCellContent(ZoneDirector.Zone zone, string objName, Vector3 pos, GameObject contentArea, Action <GameObject> spawn)
        {
            AreaCellContent item = new AreaCellContent()
            {
                zone        = zone,
                cellName    = objName,
                position    = pos,
                content     = contentArea,
                spawnAction = spawn,
            };

            CellContent.Add(item);

            return(item);
        }
コード例 #9
0
 public static void Postfix(ZoneDirector.Zone zone, PlayerState __instance) => SRCallbacks.OnZoneEnteredCallback(zone, __instance);
コード例 #10
0
ファイル: SRCallbacks.cs プロジェクト: MegaPiggy/SRML
 internal static void OnZoneEnteredCallback(ZoneDirector.Zone zone, PlayerState playerState)
 {
     OnZoneEntered?.Invoke(zone, playerState);
 }
コード例 #11
0
 [UsedImplicitly] private static void OnExitedZone_Postfix(PlayerState @this, ZoneDirector.Zone zone) => EventHandler.Instance.OnExitedZone_Trigger(@this, zone);
コード例 #12
0
 internal void OnExitedZone_Trigger(PlayerState player, ZoneDirector.Zone zone) => OnExitedZone?.Handle(args: new object[] { player, zone }, unique: true);
コード例 #13
0
 private static void Postfix(ZoneDirector.Zone zone, PlayerState __instance)
 {
     SRGuu.OnZoneEntered(zone, __instance);
 }
コード例 #14
0
        //+ ADDING TO

        /// <summary>
        /// Adds a new mutation to the spawn
        /// </summary>
        /// <param name="slime">The base slime</param>
        /// <param name="mutation">The mutation slime</param>
        /// <param name="zone">The zone restriction or NONE to be everywhere</param>
        public static void AddMutationToSpawn(Identifiable.Id slime, Identifiable.Id mutation, ZoneDirector.Zone zone = ZoneDirector.Zone.NONE)
        {
            if (MUTATIONS.ContainsKey(slime))
            {
                MUTATIONS[slime] = Tuple.Create(zone, mutation);
            }
            else
            {
                MUTATIONS.Add(slime, Tuple.Create(zone, mutation));
            }
        }
コード例 #15
0
        public static bool Prefix(QuicksilverEnergyGenerator __instance, QuicksilverEnergyGenerator.State state, bool enableSFX)
        {
            Console.Log("Parameters are: " + state + " and " + enableSFX);
            Destroyer.Destroy(__instance.countdownUI, "QuicksilverEnergyGenerator.SetState");
            Console.Log("CountdownUI destroyed");
            __instance.model.state = state;
            Console.Log("model.state setted");

            if (__instance.model.state == QuicksilverEnergyGenerator.State.COUNTDOWN)
            {
                Console.Log("if state is countdown");

                __instance.model.timer = new double?(__instance.timeDirector.HoursFromNow(__instance.countdownMinutes * 0.016666668f));
                Console.Log("Countdown: timer setted");

                if (enableSFX)
                {
                    Console.Log("Countdown: if enable SFX");

                    SECTR_AudioSystem.Play(__instance.onCountdownCue, __instance.transform.position, false);
                    Console.Log("Audio played");
                }

                if (SRSingleton <SceneContext> .Instance.PlayerState.HasUpgrade(Ids.MOCHI_HACK))
                {
                    VACPACK_ENUMS flag1 = Values.VACPACK;
                    switch (flag1)
                    {
                    case VACPACK_ENUMS.NIMBLE_VALLEY:
                        SRSingleton <SceneContext> .Instance.Player
                        .GetComponentInChildren <WeaponVacuum>()
                        .GetComponentInChildren <VacDisplayTimer>()
                        .SetQuicksilverEnergyGenerator(__instance);

                        break;

                    case VACPACK_ENUMS.DEFAULT:
                        break;

                    case VACPACK_ENUMS.AUTOMATIC:
                        ZoneDirector.Zone currentZone = SRSingleton <SceneContext> .Instance.PlayerZoneTracker.GetCurrentZone();

                        PlayerState.AmmoMode ammoMode = (currentZone == ZoneDirector.Zone.MOCHI_RANCH || currentZone == ZoneDirector.Zone.VALLEY) ?
                                                        PlayerState.AmmoMode.NIMBLE_VALLEY :
                                                        PlayerState.AmmoMode.DEFAULT;

                        if (ammoMode == PlayerState.AmmoMode.NIMBLE_VALLEY)
                        {
                            SRSingleton <SceneContext> .Instance.Player
                            .GetComponentInChildren <WeaponVacuum>()
                            .GetComponentInChildren <VacDisplayTimer>()
                            .SetQuicksilverEnergyGenerator(__instance);
                        }

                        break;
                    }
                }
                else
                {
                    SRSingleton <SceneContext> .Instance.Player
                    .GetComponentInChildren <WeaponVacuum>()
                    .GetComponentInChildren <VacDisplayTimer>()
                    .SetQuicksilverEnergyGenerator(__instance);
                }

                Console.Log("Countdown: VacDisplayTimer generator setted");

                __instance.countdownUI = UnityEngine.Object.Instantiate <GameObject>(__instance.countdownUIPrefab);
                Console.Log("Countdown: countdownUI created");

                __instance.countdownUI.GetComponent <HUDCountdownUI>().SetCountdownTime(__instance.countdownMinutes);
                Console.Log("Countdown: Timer time setted");
            }
            else if (__instance.model.state == QuicksilverEnergyGenerator.State.ACTIVE)
            {
                Console.Log("if state is active");

                __instance.model.timer = new double?(__instance.timeDirector.HoursFromNow(__instance.activeHours));
                Console.Log("Active: Timer setted");
            }
            else if (__instance.model.state == QuicksilverEnergyGenerator.State.COOLDOWN)
            {
                Console.Log("if state is cooldown");

                __instance.model.timer = new double?(__instance.timeDirector.HoursFromNow(__instance.cooldownHours));
                Console.Log("Cooldown: timer setted");

                if (enableSFX)
                {
                    Console.Log("Cooldown: if enableSFX");

                    SECTR_AudioSystem.Play(__instance.onCooldownCue, __instance.transform.position, false);
                    Console.Log("Cooldown: Play first audio");

                    SECTR_AudioSystem.Play(__instance.onCooldownCue2D, Vector3.zero, false);
                    Console.Log("Cooldown: Play second audio");
                }
            }
            else
            {
                Console.Log("if everything is null");

                __instance.model.timer = null;
                Console.Log("Null: Timer setted");

                if (enableSFX)
                {
                    Console.Log("Null: if enableSFX");

                    SECTR_AudioSystem.Play(__instance.onInactiveCue, __instance.transform.position, false);
                    Console.Log("Null: Play audio");
                }
            }
            if (__instance.inactiveFX != null)
            {
                Console.Log("if inactive FX is null");

                __instance.inactiveFX.SetActive(__instance.model.state == QuicksilverEnergyGenerator.State.INACTIVE);
                Console.Log("inactive FX setted");
            }
            if (__instance.activeFX != null)
            {
                Console.Log("if activeFX is null");

                __instance.activeFX.SetActive(__instance.model.state == QuicksilverEnergyGenerator.State.ACTIVE);
                Console.Log("activeFX setted");
            }
            if (__instance.cooldownFX != null)
            {
                Console.Log("if cooldownFX is null");

                __instance.cooldownFX.SetActive(__instance.model.state == QuicksilverEnergyGenerator.State.COOLDOWN);
                Console.Log("cooldownFX setted");
            }
            if (__instance.onStateChanged != null)
            {
                Console.Log("if onstatechanged is null");

                __instance.onStateChanged();
                Console.Log("onstatechanged setted");
            }
            return(false);
        }