Beispiel #1
0
 /// <summary>
 /// Called once per frame.
 /// </summary>
 public void Update()
 {
     if (Manager.Get().GameInProgress)
     {
         if (Input.GetKeyDown(KeyCode.Pause))
         {
             if (m_TacticalPauseTimeScaler.Paused)
             {
                 m_TacticalPauseTimeScaler.Reset();
             }
             else
             {
                 m_TacticalPauseTimeScaler.Pause();
             }
         }
     }
 }
        public void Update()
        {
            if (Manager.Get().IsLoading())
            {
                shownModInfo = false;
            }

            //Check if unstuck is ready
            if (Manager.Get().GameInProgress)
            {
                if (timer < Time.time)
                {
                    AIEntity spawnLocation = null;
                    if (Input.GetKeyDown(KeyCode.F11) || Input.GetKeyDown(KeyCode.Minus))
                    {
                        foreach (AgentAI a in AgentAI.GetAgents())
                        {
                            if (a.IsDowned)
                            {
                                a.RespawnAt(Manager.GetInputControl().GetClosestPos(a.transform.position), spawnLocation.transform.rotation);
                            }
                            //a.RespawnAt(spawnLocation.transform.position, spawnLocation.transform.rotation);
                            else
                            {
                                a.transform.position = Manager.GetInputControl().GetClosestPos(a.transform.position);
                            }
                            //a.Teleport(spawnLocation.transform);
                        }
                        timer = Time.time + 120;
                        Manager.GetUIManager().ShowMessagePopup("All agents unstuck. Now the unstuck function will be disabled for 2 minutes", 3);
                    }
                }
                else if (Input.GetKeyDown(KeyCode.F11))
                {
                    int secondsLeft = Mathf.RoundToInt(timer - Time.time);
                    int minutesLeft = secondsLeft / 60;
                    secondsLeft -= (minutesLeft * 60);
                    Manager.GetUIManager().ShowMessagePopup("Unstuck function locked." + " There is " + minutesLeft + " minutes and " + secondsLeft + " seconds until the UnStuck function is ready again.", 7);
                    //setEntityInfo("Unstuck function unnavailable", "There is " + minutesLeft + " minutes and " + secondsLeft + " seconds until the UnStuck function is ready again.");
                }
            }

            if (Manager.Get().GameInProgress)
            {
                if (!shownModInfo)
                {
                    shownModInfo = true;
                    if (SaveGame.CurrentUser.UserConfiguration.IronmanMode)
                    {
                        ironmanMode = true;
                        StopSaves();
                        Manager.GetUIManager().DoModalMessageBox("PermaDeath!", "Ultimate Ironman Gamemode Mod is active. Beware that this mod deletes your savegames if an agent dies, removes the agent and then autosaves. Good luck and have fun", InputBoxUi.InputBoxTypes.MbOk);
                        //+ string.Join(",", Manager.GetPluginManager().LoadedPlugins.Select(p => p.FullPath).ToArray())
                    }
                    else
                    {
                        ironmanMode = false;
                    }
                }
                if (ironmanMode && autoSaveTimer < Time.time)
                {
                    autoSaveTimer = Time.time + 150;
                    DeleteAllSaves();
                    Manager.Get().DoSaveGame(0);
                    Manager.Get().AutoSave();
                    Manager.DoSaveAuto();
                }

                if (Input.GetKeyDown(KeyCode.Pause))
                {
                    if (m_TacticalPauseTimeScaler.Paused)
                    {
                        m_TacticalPauseTimeScaler.Reset();
                    }
                    else
                    {
                        m_TacticalPauseTimeScaler.Pause();
                    }
                }
            }
        }