public void Show() { Loc.GetTimeManager().Pause(); Loc.GetGameController().Typing = true; _showingConsole = true; }
private static string SetTime(string args) { var split = args.Split(':'); Loc.GetTimeManager().Data.Hour = int.Parse(split[0]); Loc.GetTimeManager().Data.Minute = int.Parse(split[1]); return($"Time Set To: {Loc.GetTimeManager().Data.Hour}:{Loc.GetTimeManager().Data.Minute}"); }
public void Update() { if (Loc.GetTimeManager().Paused) { return; } LastUpdate += Time.deltaTime; if (LastUpdate > UpdateTick) { LastUpdate = 0; foreach (var blueprint in Blueprints) { if (blueprint.AssociatedBuildTask == null) { AddTask(new Build(blueprint)); } } const int maxStoreTasks = 2; var storeTasks = AllTasks.OfType <StoreItem>().ToList(); if (storeTasks.Count < maxStoreTasks) { if (StorageZones.Any(s => s.GetFreeCellCount() > 0)) { var items = DomainCells.GetCells().SelectMany(c => c.Items) .Where(i => !i.IsReserved() && !i.IsStored() && !storeTasks.Any(t => t.GetItemId() == i.Id)) .ToList(); foreach (var storageZone in StorageZones) { foreach (var item in items) { if (storageZone.CanStore(item)) { AddTask(new StoreItem(item)); break; } } } } } } ResumeDelta += Time.deltaTime; if (ResumeDelta > AutoResumeTime) { ResumeDelta = 0; foreach (var task in AvailableTasks.Where(t => t.IsSuspended() && t.AutoResume)) { task.Resume(); } } }
public void Update() { if (Loc.GetTimeManager().Paused) { return; } UpdateWorkStructures(); }
public void Update() { foreach (var step in AllButtons) { step.Value.GetComponent <Image>().color = step.Key == Loc.GetTimeManager().GetTimeStep() ? ColorConstants.BlueBase : ColorConstants.GreyBase; } TimeDisplay.text = $"{Loc.GetTimeManager().Data.Hour.ToString().PadLeft(2, '0')}:{Loc.GetTimeManager().Data.Minute.ToString().PadLeft(2, '0')}"; }
public void Toggle() { gameObject.SetActive(!gameObject.activeInHierarchy); MainMenuActive = gameObject.activeInHierarchy; if (MainMenuActive) { Loc.GetTimeManager().Pause(); } }
public static void Load(string saveFile) { Loc.GetTimeManager().Pause(); if (string.IsNullOrEmpty(saveFile)) { saveFile = Directory.EnumerateFiles(SaveDir).Last(); } Restart(Save.FromFile(saveFile)); }
public static Save MakeSave() { return(new Save { MapGenerationData = MapGenerationData.Instance, Factions = Loc.GetFactionController().Factions.Values.ToList(), Time = Loc.GetTimeManager().Data, Items = Loc.GetIdService().ItemIdLookup.Values.ToList(), CameraData = new CameraData(Loc.GetCamera()), Rooms = Loc.GetZoneController().RoomZones, Stores = Loc.GetZoneController().StorageZones, Areas = Loc.GetZoneController().AreaZones, Chunks = Loc.GetMap().Chunks.Values.Select(s => s.Data).ToList(), }); }
private void Update() { if (Loc.GetTimeManager().Paused) { return; } if (Data.FullSpan < 0) { Data.FullSpan = Data.LifeSpan; } if (Data.StartIntensity < 0) { Data.StartIntensity = Data.Intensity; } Data.TimeAlive += Time.deltaTime; Data.LifeSpan -= Time.deltaTime; if (Data.LifeSpan <= 0) { DestroySelf(); return; } float t = Data.TimeAlive / Data.LifeSpan; var step = Data.FadeOut ? Mathf.SmoothStep(0, Data.FullSpan, t) : Mathf.SmoothStep(Data.FullSpan, 0, t); if (Sprite != null) { if (Data.Fade) { Sprite.color = new Color(Sprite.color.r, Sprite.color.g, Sprite.color.b, step); } } if (Light != null) { if (Data.Fade) { Light.intensity = Data.Intensity * (Data.LifeSpan / Data.FullSpan); } } }
public void Start() { PauseButton.onClick.AddListener(() => Loc.GetTimeManager().SetTimeStep(TimeStep.Paused)); SlowButton.onClick.AddListener(() => Loc.GetTimeManager().SetTimeStep(TimeStep.Slow)); NormalButton.onClick.AddListener(() => Loc.GetTimeManager().SetTimeStep(TimeStep.Normal)); FastButton.onClick.AddListener(() => Loc.GetTimeManager().SetTimeStep(TimeStep.Fast)); FasterButton.onClick.AddListener(() => Loc.GetTimeManager().SetTimeStep(TimeStep.Hyper)); AllButtons = new Dictionary <TimeStep, Button> { { TimeStep.Paused, PauseButton }, { TimeStep.Slow, SlowButton }, { TimeStep.Normal, NormalButton }, { TimeStep.Fast, FastButton }, { TimeStep.Hyper, FasterButton } }; }
public static void HandleHotkeys() { if (Loc.GetGameController().Typing) { return; } if (Input.GetKeyDown("`")) { DeveloperConsole.Instance.Show(); } else if (Input.GetKeyDown("space")) { if (Loc.GetTimeManager().GetTimeStep() == TimeStep.Paused) { Loc.GetTimeManager().SetTimeStep(_oldTimeStep); } else { _oldTimeStep = Loc.GetTimeManager().GetTimeStep(); Loc.GetTimeManager().Pause(); } } else if (Input.GetKeyDown("escape")) { Loc.GetGameController().MainMenuController.Toggle(); } else if (Input.GetKeyDown("1")) { Loc.GetTimeManager().SetTimeStep(TimeStep.Slow); } else if (Input.GetKeyDown("2")) { Loc.GetTimeManager().SetTimeStep(TimeStep.Normal); } else if (Input.GetKeyDown("3")) { Loc.GetTimeManager().SetTimeStep(TimeStep.Fast); } else if (Input.GetKeyDown("4")) { Loc.GetTimeManager().SetTimeStep(TimeStep.Hyper); } else if (Input.GetKeyDown("b")) { Loc.GetGameController().OrderSelectionController.BuildTypeClicked(); } else if (Input.GetKeyDown("n")) { Loc.GetGameController().OrderSelectionController.DesignateTypeClicked(); } else if (Input.GetKeyDown("z")) { Loc.GetGameController().OrderSelectionController.ZoneTypeClicked(); } else if (Input.GetKeyDown("c")) { Loc.GetGameController().OrderSelectionController.ConstructTypeClicked(); } else if (Input.GetKeyDown("e")) { Loc.Current.Get <CursorController>().RotateRight(); } else if (Input.GetKeyDown("q")) { Loc.Current.Get <CursorController>().RotateLeft(); } else if (Input.GetKeyDown(KeyCode.Tab)) { Loc.GetGameController().UIController.Toggle(); } }
public Timer GetTimer() { return(Loc.GetTimeManager().GetTimer(TimerId)); }
public Wait(int duration, string reason, AnimationType animation = AnimationType.Idle) : this() { Animation = animation; TimerId = Loc.GetTimeManager().StartTimer(duration); Reason = reason; }