Esempio n. 1
0
        public bool AssignNonExcludedFollower(NPCBase follower, Vector3Int position)
        {
            var job = follower.Job;

            if (!IsJobExcluded(job))
            {
                try
                {
                    if (follower.Job != null)
                    {
                        follower.Job.NPC = null;
                        follower.ClearJob();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log("ActivateMilitia Error has occurred: {0}", ex.Message);
                }

                var militiaJob = new MilitiaJob();
                militiaJob.InitializeJob(player, position, follower.ID);
                militiaJob.OnAssignedNPC(follower);
                follower.TakeJob(militiaJob);
                ColonyManager.AddJobs(militiaJob);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 void MainMenuGUI()
 {
     GUI.skin = Ourskin;
     GUI.DrawTexture(new Rect(Screen.width / 2 - 176, 100, 352, 148), Resources.Load("Textures/redrover") as Texture);
     GUILayout.BeginArea(new Rect(Screen.width / 2 - 70, Screen.height / 2 + 50, 140, 200));
     if (GUILayout.Button("Start"))
     {
         colonyManager = gameObject.AddComponent <ColonyManager>();
         currentGUI    = ColonyGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Instructions"))
     {
         menuGUI    = currentGUI;
         currentGUI = InstructionsGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Options"))
     {
         menuGUI    = currentGUI;
         currentGUI = OptionsMenuGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Credits"))
     {
         menuGUI    = currentGUI;
         currentGUI = CreditsGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     GUILayout.EndArea();
 }
Esempio n. 3
0
 public bool AssignLaborerFirst(NPCBase follower, Vector3Int position)
 {
     if (follower.NPCType.IsLaborer)
     {
         var militiaJob = new MilitiaJob();
         militiaJob.InitializeJob(player, position, follower.ID);
         militiaJob.OnAssignedNPC(follower);
         follower.TakeJob(militiaJob);
         ColonyManager.AddJobs(militiaJob);
         return(true);
     }
     return(false);
 }
Esempio n. 4
0
    void Start()
    {
        #region ColonerSearcher

        /*GameObject[] colonersGO = GameObject.FindGameObjectsWithTag("Character");
         * coloners = new Coloner[colonersGO.Length];
         * int i = 0;
         * foreach(GameObject col in colonersGO)
         * {
         *  coloners[i] = col.GetComponent<Coloner>();
         *  i++;
         *  print(coloners[i].name);
         * }
         * print("There are " + i + " coloners");
         */
        #endregion

        instance = this;

        gridScript = GameObject.Find("A_").GetComponent <Grid>();
        analytics  = GetComponent <GameAnalytics>();
    }
Esempio n. 5
0
 void PauseMenuGUI()
 {
     GUI.skin = Ourskin;
     GUI.DrawTexture(new Rect(Screen.width / 2 - 176, 100, 352, 148), Resources.Load("Textures/redrover") as Texture);
     GUILayout.BeginArea(new Rect(Screen.width / 2 - 70, Screen.height / 2 + 50, 140, 200));
     if (GUILayout.Button("Resume"))
     {
         currentGUI     = pausedGUI;
         Time.timeScale = 1;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("New Game"))
     {
         DestroyImmediate(colonyManager);
         colonyManager  = gameObject.AddComponent <ColonyManager>();
         Time.timeScale = 1;
         currentGUI     = ColonyGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Instructions"))
     {
         menuGUI    = currentGUI;
         currentGUI = InstructionsGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Options"))
     {
         menuGUI    = currentGUI;
         currentGUI = OptionsMenuGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     if (GUILayout.Button("Credits"))
     {
         menuGUI    = currentGUI;
         currentGUI = CreditsGUI;
         audio.PlayOneShot(buttonPressSound);
     }
     GUILayout.EndArea();
 }
Esempio n. 6
0
            static AnimalGeneticsAssemblyLoader()
            {
                var h = new Harmony("AnimalGenetics");

                h.PatchAll();

                DefDatabase <StatDef> .Add(AnimalGenetics.Damage);

                DefDatabase <StatDef> .Add(AnimalGenetics.Health);

                DefDatabase <StatDef> .Add(AnimalGenetics.GatherYield);

                var affectedStats = Constants.affectedStatsToInsert;

                foreach (var stat in affectedStats)
                {
                    try
                    {
                        stat.parts?.Insert(0, new StatPart(stat));
                    }
                    catch
                    {
                        Log.Error(stat + " is broken");
                    }
                }

                var category = new StatCategoryDef {
                    defName = "AnimalGenetics_Category", label = "Genetics", displayAllByDefault = true, displayOrder = 200
                };

                DefDatabase <StatCategoryDef> .Add(category);

                foreach (var stat in Constants.affectedStats)
                {
                    DefDatabase <StatDef> .Add(new StatDefWrapper { defName = "AnimalGenetics_" + stat.defName, label = Constants.GetLabel(stat), Underlying = stat, category = category, workerClass = typeof(StatWorker), toStringStyle = ToStringStyle.PercentZero });
                }

                StatDefOf.MarketValue.parts.Add(new MarketValueCalculator());

                gatherableTypes = new List <Type>()
                {
                    typeof(CompShearable),
                    typeof(CompMilkable)
                };

                // Compatibility patches
                try
                {
                    if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageId == "sarg.alphaanimals" || x.Name == "Alpha Animals"))
                    {
                        Log.Message("Animal Genetics : Alpha Animals is loaded - Patching");
                        h.Patch(AccessTools.Method(AccessTools.TypeByName("AlphaBehavioursAndEvents.CompAnimalProduct"), "get_ResourceAmount"),
                                postfix: new HarmonyMethod(typeof(CompatibilityPatches), nameof(CompatibilityPatches.AlphaAnimals_get_ResourceAmount_Patch)));
                        gatherableTypes.Add(AccessTools.TypeByName("AlphaBehavioursAndEvents.CompAnimalProduct"));
                    }
                    if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageId == "CETeam.CombatExtended" || x.Name == "Combat Extended"))
                    {
                        //gatherableTypes.Append(AccessTools.TypeByName("CombatExtended.CompMilkableRenameable")); //they all use shearable
                        gatherableTypes.Add(AccessTools.TypeByName("CombatExtended.CompShearableRenameable"));
                    }

                    if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageId == "rim.job.world"))
                    {
                        Log.Message("Patched RJW");
                        h.Patch(AccessTools.Method(AccessTools.TypeByName("rjw.Hediff_BasePregnancy"), "GenerateBabies"),
                                prefix: new HarmonyMethod(typeof(CompatibilityPatches), nameof(CompatibilityPatches.RJW_GenerateBabies_Prefix)),
                                postfix: new HarmonyMethod(typeof(CompatibilityPatches), nameof(CompatibilityPatches.RJW_GenerateBabies_Postfix)));
                    }
                }
                catch { }

                if (ColonyManager.ModRunning && Settings.Integration.ColonyManagerIntegration)
                {
                    ColonyManager.Patch(h);
                }

                _DefaultAnimalsPawnTableDefColumns  = new List <PawnColumnDef>(PawnTableDefOf.Animals.columns);
                _DefaultWildlifePawnTableDefColumns = new List <PawnColumnDef>(PawnTableDefOf.Wildlife.columns);

                var placeholderPosition = MainTabWindow_AnimalGenetics.PawnTableDefs.Genetics.columns.FindIndex(def => def.defName == "AnimalGenetics_Placeholder");

                MainTabWindow_AnimalGenetics.PawnTableDefs.Genetics.columns.RemoveAt(placeholderPosition);
                MainTabWindow_AnimalGenetics.PawnTableDefs.Genetics.columns.InsertRange(placeholderPosition, PawnTableColumnsDefOf.Genetics.columns);

                PatchUI();
            }
Esempio n. 7
0
    void AuditGUI()
    {
        GUI.skin = Ourskin;
        GUI.Box(new Rect(Screen.width / 2 - 200, 50, 400, 500), GUIContent.none);

        GUI.Label(new Rect(Screen.width / 2 - 90, 55, 200, 40), "performance audit");

        GUI.skin = null;
        GUI.Box(new Rect(Screen.width / 2 - 180, 80, 360, 420), GUIContent.none);
        GUI.skin = Ourskin;

        GUI.Label(new Rect(Screen.width / 2 - 150, 100, 300, 25), "GENERAL STATS");
        GUI.Label(new Rect(Screen.width / 2 - 150, 125, 300, 25), "money: " + colonyManager.money.ToString());
        GUI.Label(new Rect(Screen.width / 2 - 150, 150, 300, 25), "total iron sold: " + colonyManager.totalIronSold.ToString());
        GUI.Label(new Rect(Screen.width / 2 - 150, 175, 300, 25), "times audited: " + (colonyManager.timesAudited).ToString());

        GUI.Label(new Rect(Screen.width / 2 - 150, 225, 300, 25), "AUDIT");
        GUI.Label(new Rect(Screen.width / 2 - 150, 250, 300, 25), "iron goal: " + colonyManager.lastAuditGoal.ToString());
        GUI.Label(new Rect(Screen.width / 2 - 150, 275, 300, 25), "iron sold since last audit: " + colonyManager.lastAuditAmount.ToString());
        GUI.Label(new Rect(Screen.width / 2 - 150, 300, 325, 25), "strikes: " + colonyManager.strikes.ToString());
        if (colonyManager.lastAuditAmount >= colonyManager.lastAuditGoal)
        {
            GUI.Label(new Rect(Screen.width / 2 - 150, 325, 400, 60), "GOOD JOB!\nCONTINUE YOUR SUCCESS.");
        }
        else if (colonyManager.strikes >= 3)
        {
            GUI.Label(new Rect(Screen.width / 2 - 150, 325, 400, 60), "THREE STRIKES!\nYOU'RE FIRED!");
        }
        else
        {
            GUI.Label(new Rect(Screen.width / 2 - 150, 325, 400, 60), "YOU'VE EARNED A STRIKE!\nYOU MUST IMPROVE.");
        }



        // Game Failed Condition
        if (colonyManager.strikes >= 3)
        {
            if (GUI.Button(new Rect(Screen.width / 2 - 50, 510, 100, 30), "main menu"))
            {
                KongregateAPI kongAPI = gameObject.GetComponent <KongregateAPI>();
                kongAPI.SubmitStats("gameCompleted", 1);
                kongAPI.SubmitStats("mostTotalIron", colonyManager.totalIronSold);
                kongAPI.SubmitStats("mostAuditTimes", colonyManager.timesAudited);

                DestroyImmediate(colonyManager);
                colonyManager  = null;
                Time.timeScale = 1;
                currentGUI     = MainMenuGUI;
            }
        }
        else
        {
            GUI.Label(new Rect(Screen.width / 2 - 150, 400, 400, 25), "NEW GOAL");
            GUI.Label(new Rect(Screen.width / 2 - 150, 425, 400, 25), "new iron goal: " + colonyManager.auditGoal.ToString());

            if (GUI.Button(new Rect(Screen.width / 2 - 50, 510, 100, 30), "resume"))
            {
                Time.timeScale         = 1;
                colonyManager.auditing = false;
                currentGUI             = pausedGUI;
                KongregateAPI kongAPI = gameObject.GetComponent <KongregateAPI>();
                kongAPI.SubmitStats("mostTotalIron", colonyManager.totalIronSold);
                kongAPI.SubmitStats("mostAuditTimes", colonyManager.timesAudited);
            }
        }
    }
Esempio n. 8
0
 //Pehromone is a standalone Object and will destroy himself after setted time
 private void Start()
 {
     m_ColonyManager = FindObjectOfType <ColonyManager>();
     m_LifeTime      = ColonyOptions.PheromoneDuration;
     gameObject.tag  = m_Tag;
 }