public CoreUpdate(WorldManager manager) { _watch = new Stopwatch(); _worldTime = new WorldTime(); ResetEvent = new AutoResetEvent(true); _manager = manager; }
public void Update() { TimeManager tm = TimeManager.Instance; WorldTime time = tm.WorldTime; textComponent.text = time.ToString(); }
// Use this for initialization void Start() { WorldTimeObj = GameObject.Find("Master"); worldtime = WorldTimeObj.GetComponent <WorldTime>(); DefaltPos = transform.position; DefaltPos.x = -MaxMoveDistance; }
// Update is called once per frame void Update() { int timeLeft = Mathf.Max(0, chaseEndTime - WorldTime.worldTimeInHours); string timeString = WorldTime.ConvertToTimeString(timeLeft); textUI.text = chaserName + ": " + timeString; }
public void Reset() { this.Seed = (int)DateTime.UtcNow.TimeOfDay.Ticks; m_CurrentMap = null; m_Scoring = new Scoring(); m_World = null; m_WorldTime = new WorldTime(); this.LastTurnPlayerActed = 0; m_Event_Raids = new int[(int)RaidType._COUNT, RogueGame.Options.CitySize, RogueGame.Options.CitySize]; for (int i = (int)RaidType._FIRST; i < (int)RaidType._COUNT; i++) { for (int x = 0; x < RogueGame.Options.CitySize; x++) { for (int y = 0; y < RogueGame.Options.CitySize; y++) { m_Event_Raids[i, x, y] = -1; } } } //////////////////////////// // Reset special properties. //////////////////////////// this.CHARUndergroundFacility_Activated = false; this.PlayerKnows_CHARUndergroundFacilityLocation = false; this.PlayerKnows_TheSewersThingLocation = false; this.ScriptStage_PoliceStationPrisonner = ScriptStage.STAGE_0; this.UniqueActors = new UniqueActors(); this.UniqueItems = new UniqueItems(); this.UniqueMaps = new UniqueMaps(); }
void Awake() { GameObject obj = GameObject.FindGameObjectWithTag("GameManager"); gametime = (WorldTime)obj.GetComponent <WorldTime> (); gameManager = (GameManager)obj.GetComponent <GameManager> (); }
public override void Select(MainForm frm) { base.Select(frm); foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionPurge)) { frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage); } if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionPurge)) { frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionPurge); } if (StartTime != null || EndTime != null) { frm.lblPurgeTime.Text = $"{StartTime} - {EndTime}"; frm.lblPurgeDuration.Text = WorldTime.Duration(EndTime, StartTime); } else { frm.lblPurgeTime.Text = ""; frm.lblPurgeDuration.Text = ""; } frm.lblPurgeOrdinal.Text = Ordinal.ToString(); frm.lblPurgeSite.Data = Site; frm.lblPurgeAdjective.Text = Adjective; frm.lstPurgeEvents.Items.Clear(); if (Event != null) { frm.lstPurgeEvents.Items.AddRange(Event.ToArray()); } SelectTab(frm); }
private void CreateRendererStates() { _logRendererState = new LogRendererState { Visible = _logConfiguration.Visible, MaximumVisibleLogLines = _logConfiguration.MaximumVisibleLogLines, MinimumWindowWidth = _logConfiguration.MinimumWindowWidth, LogEntryLifetime = _logConfiguration.LogEntryLifetime, ShowTimestamps = _logConfiguration.ShowTimestamps, ShowRaisingEvents = _logConfiguration.ShowRaisingEvents }; _worldTimeRendererState = new WorldTimeRendererState { Visible = _worldTimeConfiguration.Visible }; var worldTime = new WorldTime(_worldTimeRendererState); var worldObserver = new WorldObserver(worldTime, _logRendererState); _worldInstance = new WorldInstance(_world, _player, worldTime, worldObserver, _multimediaPlayer); _boardRendererState = new BoardRendererState(_worldInstance.Player); _fpsRendererState = new FpsRendererState { Visible = _fpsConfiguration.Visible }; }
/* * Checks all input sources for a player pressing "Start" and binds them when they join. */ void PollForNewPlayer() { int nextPlayerIndex = NumPlayers; foreach (InputDevice device in InputDevices.GetAllInputDevices()) { if (!boundDevices.ContainsKey(device) || (IsCheatingEnabled && cheats.BIND_MANY_TO_ONE_DEVICE)) { if (RBInput.GetButtonDownForPlayer(InputStrings.PAUSE, nextPlayerIndex, device)) { BindNextPlayer(device); // Deactivate the splash screen once a player is bound. This is NOT ideal, but // neither is putting a splash screen into every scene. It should be it's own scene. WorldTime worldTime = (WorldTime)GetComponent <WorldTime> (); Transform startPoint = worldTime.startPointP2; if (NumPlayers == 1) { HideSplashScreen(); worldTime.Reset(); } else { players [nextPlayerIndex].GetComponent <PlayerController> ().SnapToPoint(startPoint); } } } } }
public GameTimer(WorldTime DFWorldTime) { unknownInformation = new List <string>(); running = false; complete = false; worldTime = DFWorldTime; }
public void StartGame(int difficulty, GameEndCallback callback) { FocusMe(); this.callback = callback; isGameRunning = true; spawnedNotes = new List <Note>(4); errorCount = 0; noteCount = 0; spawnNotes = true; root.SetActive(true); WorldTime.Pause(); if (difficulty == 1) { currentGameDiff = easy; } else if (difficulty == 2) { currentGameDiff = medium; } else { currentGameDiff = hard; } SpawnNote(currentGameDiff); timeTillNextNote = currentGameDiff.GetSpawnIntervall(); UpdateErrorCountText(); }
public static void SetTVTLua(Lua lua) { lua.DoFile("res\\ai\\SLF.lua"); lua.DoFile("res\\ai\\AIEngine.lua"); lua.DoFile("res\\ai\\BudgetManager.lua"); lua.DoFile("res\\ai\\TestAIPlayer.lua"); var player = new Player(); var tvt = new TVT(); var worldTime = new WorldTime(); lua.NewTable("MY"); lua.RegisterFunction("MY.GetMoney", player, typeof(Player).GetMethod("GetMoney")); lua.NewTable("TVT"); lua.RegisterFunction("TVT.addToLog", tvt, typeof(TVT).GetMethod("AddToLog")); lua.RegisterFunction("TVT.GetMillisecs", tvt, typeof(TVT).GetMethod("GetMillisecs")); lua.NewTable("WorldTime"); lua.RegisterFunction("WorldTime.GetDaysRun", worldTime, typeof(WorldTime).GetMethod("GetDaysRun")); lua.RegisterFunction("WorldTime.GetTimeGoneAsMinute", worldTime, typeof(WorldTime).GetMethod("GetTimeGoneAsMinute")); lua.DoString(@"globalPlayer = TestAIPlayer() globalPlayer:initialize() _G['globalPlayer'] = globalPlayer" ); }
/*Purpose: To deserialize a copy of the datetime from a file if that file exists */ private void loadClockData() { if (File.Exists(Application.persistentDataPath + "/WorldData.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/WorldData.dat", FileMode.Open); string fromFile = ""; //Holds the value of the saved time, once obtained from try catch statement try { fromFile = bf.Deserialize(file) as string; } catch (EndOfStreamException e) { Debug.Log("Failed Load"); return; } file.Close(); //Convert the string form of time to a datetime DateTime toLoad = DateTime.Parse(fromFile, null, DateTimeStyles.RoundtripKind); //set the world time in the scene WorldTime time = FindObjectOfType(typeof(WorldTime)) as WorldTime; time.WORLDTIME = toLoad; } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { WorldTime worldtime = (WorldTime)GameObject.FindGameObjectWithTag("GameManager").GetComponent <WorldTime> (); worldtime.GoToNextDay(); } }
private void OnDayNightUpdated(bool isDaytime) { WorldTime worldTime = isDaytime ? WorldTime.Day : WorldTime.Night; UnturnedDayNightUpdatedEvent @event = new UnturnedDayNightUpdatedEvent(worldTime, LightingManager.isFullMoon); Emit(@event); }
void Start() { TargetObj = GameObject.Find("Player"); WorldTimeObj = GameObject.Find("Master"); worldtime = WorldTimeObj.GetComponent <WorldTime>(); vec = (TargetObj.transform.position - transform.position).normalized; Destroy(gameObject, 10); }
internal static object DBExport(this WorldTime time, bool year) { if (time == null) { return(DBNull.Value); } return(year ? time.Year : time.TotalSeconds); }
public static void ChangeTime(WorldTime newTime) { if (_instance == null) { return; } _instance.CurrentTime = newTime; _instance.OnTimeChange.Invoke(); }
public void Story3Case() { //http://www.bangkokpost.com/learning/learning-together/278662/k-pop-groupie-has-his-ticket //“The Korean pop group Girls’ Generation poses on the red carpet at the MNET Asian Music Awards ceremony in Singapore last November.” WorldTime.LastNovember(new Korean().GetPopulationByName <GirlsGeneration>("Girls’ Generation").Poses().On(new Carpet { Color = "Red" }).At(new MNETAsianMusicAwards()).In(new Singapore())); }
private void Awake() { if (Instance == null) { Instance = this; } else { throw new TwoWorldTimeException(); } }
public override void Select(MainForm frm) { base.Select(frm); foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionAbduction)) { frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage); } if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionAbduction)) { frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionAbduction); } frm.lblAbductionRegion.Data = Subregion; frm.lblAbductionSite.Data = Site; frm.lblAbductionCoords.Data = new Coordinate(Coords); frm.lblAbductionAttacker.Data = AttackingEn; frm.lblAbductionDefender.Data = DefendingEn; frm.lblAbductionParent.Data = ParentEventCol; if (StartTime != null || EndTime != null) { frm.lblAbductionTime.Text = string.Format("{0} - {1}", StartTime, EndTime); frm.lblAbductionDuration.Text = WorldTime.Duration(EndTime, StartTime); } else { frm.lblAbductionTime.Text = ""; frm.lblAbductionDuration.Text = ""; } frm.lblAbductionOrdinal.Text = Ordinal.ToString(); frm.lstAbductionEvents.Items.Clear(); if (Event != null) { frm.lstAbductionEvents.Items.AddRange(Event.ToArray()); } frm.grpAbductionEvents.Visible = frm.lstAbductionEvents.Items.Count > 0; if (frm.lstAbductionEvents.Items.Count > 0) { frm.lstAbductionEvents.SelectedIndex = 0; } frm.lstAbductionEventCols.Items.Clear(); if (EventCol != null) { frm.lstAbductionEventCols.Items.AddRange(EventCol.ToArray()); } frm.grpAbductionEventCols.Visible = frm.lstAbductionEventCols.Items.Count > 0; SelectTab(frm); }
internal void UpdateTime() { if (!isRunning) { return; } this.time = new WorldTime((int)(GetPreciseTicks() / TimeSpan.TicksPerSecond)); pUpdateTime(); }
void Start() { worldTime = FindObjectOfType <WorldTime>(); worldTime.OnTimeChangedEvent += SetTimeText; UIEventHandler.OnPlayerHealthChanged += UpdateHealthBar; UIEventHandler.OnPlayerMagickaChanged += UpdateMagickaBar; UIEventHandler.OnPlayerStaminaChanged += UpdateStaminaBar; UIEventHandler.OnPlayerXPChanged += UpdateExp; UIEventHandler.OnPlayerSkillsChanged += UpdateSkills; }
/// <summary> /// Perishable food. /// </summary> /// <param name="model"></param> /// <param name="bestBefore"></param> public ItemFood(ItemModel model, int bestBefore) : base(model) { if (!(model is ItemFoodModel)) { throw new ArgumentException("model is not a FoodModel"); } this.Nutrition = (model as ItemFoodModel).Nutrition; this.BestBefore = new WorldTime(bestBefore); this.IsPerishable = true; }
public override void Select(MainForm frm) { base.Select(frm); foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionTheft)) { frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage); } if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionTheft)) { frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionTheft); } frm.lblTheftSite.Data = Site; frm.lblTheftCoords.Data = Site != null ? new Coordinate(Site.Coords) : null; frm.lblTheftAttacker.Data = AttackingEn; frm.lblTheftDefender.Data = DefendingEn; frm.lblTheftWar.Data = WarEventCol; if (StartTime != null || EndTime != null) { frm.lblTheftTime.Text = $"{StartTime} - {EndTime}"; frm.lblTheftDuration.Text = WorldTime.Duration(EndTime, StartTime); } else { frm.lblTheftTime.Text = ""; frm.lblTheftDuration.Text = ""; } frm.lblTheftOrdinal.Text = Ordinal.ToString(); frm.lstTheftEvents.Items.Clear(); if (Event != null) { frm.lstTheftEvents.Items.AddRange(Event.ToArray()); } frm.grpTheftEvents.Visible = frm.lstTheftEvents.Items.Count > 0; if (frm.lstTheftEvents.Items.Count > 0) { frm.lstTheftEvents.SelectedIndex = 0; } frm.lstTheftEventCols.Items.Clear(); if (EventCol != null) { frm.lstTheftEventCols.Items.AddRange(EventCol.ToArray()); } frm.grpTheftEventCols.Visible = frm.lstTheftEventCols.Items.Count > 0; SelectTab(frm); }
public override void Update(GameTime gameTime) { WorldTime.Update(GameTime.DeltaTime); CheckDeads(); foreach (Entity item in Entities) { item.Update(GameTime.DeltaTime); } if (WorldTime.FinishedDay) { NewDay(); } }
private RoomBackground GetBackground() { if (conditionalBackgrounds.Count == 0) { // There's just one background: The default one. Return it. return(defaultBackground); } // Try to find the time-appropriate background WorldTime currentTime = World.Instance.CurrentTime; if (conditionalBackgrounds.ContainsKey(currentTime)) { return(conditionalBackgrounds[currentTime]); } // If it wasn't found, look for similar ones (dawn is kinda like morning and night is kinda like dark!) switch (currentTime) { case WorldTime.Dawn: if (conditionalBackgrounds.ContainsKey(WorldTime.Morning)) { return(conditionalBackgrounds[WorldTime.Morning]); } break; case WorldTime.Morning: if (conditionalBackgrounds.ContainsKey(WorldTime.Dawn)) { return(conditionalBackgrounds[WorldTime.Dawn]); } break; case WorldTime.Night: if (conditionalBackgrounds.ContainsKey(WorldTime.Dark)) { return(conditionalBackgrounds[WorldTime.Dark]); } break; case WorldTime.Dark: if (conditionalBackgrounds.ContainsKey(WorldTime.Night)) { return(conditionalBackgrounds[WorldTime.Night]); } break; } // No appropriate background found? Just return the default one return(defaultBackground); }
public static void SetTime(object sender, string cmd, string[] param, out Dictionary <string, object> returnVal) { StringBuilder msgSB = new StringBuilder(); WorldTime time = WorldTime.Zero; float rate = 0f; bool foundTime = false, foundRate = false; for (int i = 0; i < param.Length; i++) { if ((!foundRate) && (float.TryParse(param[i], out rate))) { foundRate = true; } if ((!foundTime) && (WorldTime.TryParseDayHourMin(param[i], out time))) { foundTime = true; } if (foundTime && foundRate) { break; } } if (!(foundTime || foundRate)) { msgSB.Append("No valid WorldTime or rate provided!"); } else { if (!foundTime) { time = WorldInst.List[0].Clock.Time; } if (!foundRate) { rate = WorldInst.List[0].Clock.Rate; } WorldInst.List[0].Clock.SetTime(time, rate); msgSB.Append("Changed WorldTime to: "); msgSB.AppendFormat("( time: {0}, rate: {1} )", time, rate); } returnVal = new Dictionary <string, object> { { "type", WSProtocolType.chatData }, { "sender", "SERVER" }, { "rawText", msgSB.ToString() }, }; }
public override void Select(MainForm frm) { base.Select(frm); foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionInsurrection)) { frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage); } if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionInsurrection)) { frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionInsurrection); } frm.lblInsurrectionSite.Data = Site; frm.lblInsurrectionParent.Data = ParentEventCol; frm.lblInsurrectionCoords.Data = new Coordinate(Site != null ? Site.Location : Point.Empty); if (StartTime != null || EndTime != null) { frm.lblInsurrectionTime.Text = string.Format("{0} - {1}", StartTime, EndTime); frm.lblInsurrectionDuration.Text = WorldTime.Duration(EndTime, StartTime); } else { frm.lblInsurrectionTime.Text = ""; frm.lblInsurrectionDuration.Text = ""; } frm.lblInsurrectionTargetEnt.Data = TargetEnt; frm.lblInsurrectionOutcome.Text = Outcome; frm.lblInsurrectionOrdinal.Text = Ordinal.ToString(); frm.lstInsurrectionEvents.Items.Clear(); if (Event != null) { frm.lstInsurrectionEvents.Items.AddRange(Event.ToArray()); } frm.grpInsurrectionEvents.Visible = frm.lstInsurrectionEvents.Items.Count > 0; if (frm.lstInsurrectionEvents.Items.Count > 0) { frm.lstInsurrectionEvents.SelectedIndex = 0; } SelectTab(frm); }
public void Update(WorldTime time) { if (time.TickCount % 5 == 0) { foreach (var i in Entities.ToArray()) { if (Manager.Core.Map.Players.FirstOrDefault().Value != null) { var player = Manager.Core.Map.Players.FirstOrDefault(); i.Move(player.Value.X, player.Value.Y); } } } }
void DayTimeChanged( WorldTime.DayTimeTypes timeType ) { bool activateSI = false; foreach( WorldTime.DayTimeTypes type in ActivateOnTimes ) if( type == timeType ) { activateSI = true; break; } if( activateSI ) { strobeInterpolator = GetComponent<StrobeLightInterpolator>(); if( strobeInterpolator ) { strobeInterpolator.Restart(); } } }
/// <summary> /// Creates a new play state /// </summary> /// <param name="game">The program currently running</param> /// <param name="stateManager">The game state manager this state will belong to</param> public PlayState(DwarfGame game, GameStateManager stateManager) : base(game, "PlayState", stateManager) { ShouldReset = true; Paused = false; Content = Game.Content; GraphicsDevice = Game.GraphicsDevice; Seed = Random.Next(); RenderUnderneath = true; WorldOrigin = new Vector2(WorldWidth / 2, WorldHeight / 2); PreSimulateTimer = new Timer(3, false); Time = new WorldTime(); }
void OnDayTimeChanged( WorldTime.DayTimeTypes type ) { DayTimeType = WorldTime.Instance.CurrentTimeType; if( DebugPrintTransition ) Console.Instance.addGameChatMessage( type.ToString() ); // Tests from largest to least times // doing reverse order in this way is slightly faster switch( type ) { case WorldTime.DayTimeTypes.Midnight: FromSetting = Midnight; ToSetting = Dawn; break; case WorldTime.DayTimeTypes.Dawn: FromSetting = Dawn; ToSetting = Sunrise; break; case WorldTime.DayTimeTypes.Sunrise: FromSetting = Sunrise; ToSetting = Noon; break; case WorldTime.DayTimeTypes.Noon: FromSetting = Noon; ToSetting = Sunset; break; case WorldTime.DayTimeTypes.Sunset: FromSetting = Sunset; ToSetting = Twilight; break; case WorldTime.DayTimeTypes.Twilight: if( DayPercent >= WorldTime.Instance.TwilightTime ) { FromSetting = Twilight; ToSetting = MidnightWrapped; } else { FromSetting = TwilightWrapped; ToSetting = Midnight; } break; } }
// Use this for initialization void Start() { worldTime = GameObject.Find("WorldTime").GetComponent<WorldTime>(); }
void Start() { timer = GameObject.FindGameObjectWithTag ("WorldTime").GetComponent<WorldTime>(); targetCol = sunnyCol_day; rainParticleSystem.SetActive(false); snowParticleSystem.SetActive(false); }
void Awake () { GameObject obj = GameObject.FindGameObjectWithTag ("GameManager"); gametime = (WorldTime)obj.GetComponent<WorldTime> (); gameManager = (GameManager)obj.GetComponent<GameManager> (); }