public static void Render(this Scene scene) { if (_bmp == null || _bmp.Size != MainForm.instance.pictureBox.Size) { _bmp = new Bitmap(scene.Size.X * modifier + modifier * 2, scene.Size.Y * modifier + modifier * 2); _graph = Graphics.FromImage(_bmp); } _graph.Clear(Color.DarkRed); foreach (var gameObject in scene.Childrens) { (gameObject as GameObject).Render(); } MainForm.instance.pictureBox.Image = _bmp; if (Player.instance.SelectedObject != null) { _graph.DrawRectangle(new Pen(Color.Yellow, modifier / 10), Player.instance.SelectedObject.GetRectangle()); } else { ScreenUpdater.OnUnselected(); } }
public static void Create() { _instance = new InventoryPanel(); MainForm.instance.pictureBox.Controls.Add(_instance); _instance.Show(); IsShowed = true; MainForm.GameState = GameStates.Inventory; if (Player.instance.Inventory.Count > 0) { (_instance.Controls[_selectedItem] as ItemButton).Select(); } ScreenUpdater.OnUnselected(); }
public static void CheckSelectableItems() { instance.SelectedObject = (GameObject)Game.instance.ActiveScene.Childrens .FirstOrDefault( u => (u as GameObject).Position.Distance(instance.Position) < 1.5 && u is IUsable && !(u as IUsable).Used ); if (instance.SelectedObject != null) { ScreenUpdater.OnSelected(instance.SelectedObject); } else { ScreenUpdater.OnUnselected(); } }