public static void Create(TimeData data) { if (IsCreated) { return; } IsCreated = true; Time.data = data; }
public MainGameModel() { Physics = new World(new Vector2(0, 0)); Physics.SetContactListener(new GlobalContactListner()); map = new GameMap(new Size(100, 100), new Size(1000, 1000), Physics); const int border = 3000; var allowedCoordinates = new Rectangle(border, border, map.MapSize.Width - 2 * border, map.MapSize.Height - 2 * border); player = new Player(allowedCoordinates, new Vector2D(5000, 5000)); GameBasicCamera = new SmoothCamera(new Size(), player); Controls = new Controls(GameBasicCamera); var axes = new HashSet <Axis> { new Axis("horizontal", Keys.D, Keys.A), new Axis("vertical", Keys.W, Keys.S) }; Controls.AxesHandler = axes.ToDictionary(x => x.Name); Input.Create(Controls); Time = new TimeData(); VoidTime.Time.Create(Time); gameTick = new Timer(16.66667F); var planet = new Planet { Position = new Vector2D(5000, 5000), DrawingPriority = 1 }; map.AddGameObjects(planet, player); gameTick.Elapsed += FrameTick; player.StartingBattle += StartBattle; }