Example #1
0
 public override void Update(GameTime gameTime)
 {
     WorldTime.Update(GameTime.DeltaTime);
     CheckDeads();
     foreach (Entity item in Entities)
     {
         item.Update(GameTime.DeltaTime);
     }
     if (WorldTime.FinishedDay)
     {
         NewDay();
     }
 }
Example #2
0
        protected override void Update(GameTime gameTime)
        {
            CheckAspectRatio();
            if (!PauseWorldTime)
            {
                WorldTime.Update(gameTime);
            }

            HandleKeyboard();
            HandleMouse();
            DebugScreen.UpdateUPS(gameTime);


            base.Update(gameTime);
        }
Example #3
0
        public void Update()
        {
            Profiler.BeginSample("Game_Update_RegionManagerUpdate");
            _regionManager.Update();
            Profiler.EndSample();

            Profiler.BeginSample("Game_Update_WorldTimeUpdate");
            WorldTime.Update();
            Profiler.EndSample();

            foreach (var positionalAudio in _positionalAudio)
            {
                positionalAudio.Update();
            }

            if (Input.GetKeyDown(KeyCode.V))
            {
                var position = new Vector2Int(Mathf.FloorToInt(Size.x / 2), UnityEngine.Random.Range(0, Size.y));
                CreateAtPosition(TypeOfThing.Villager, position);
            }

            if (Input.GetKeyDown(KeyCode.O))
            {
                var random = _things[UnityEngine.Random.Range(0, _things.Count)];
                Remove(random);
            }

            if (Input.GetKeyDown(KeyCode.B))
            {
                var toBuild = _things.Where(t => t.Config.TypeOfThing == TypeOfThing.Blueprint).ToArray();
                foreach (var thing in toBuild)
                {
                    thing.Construct();
                }
            }

            if (_loaded)
            {
                _timeSinceLoaded += Time.deltaTime;
            }
        }