public ToolEntity(Unit unit, Rectangle rect, bool isSelected, bool isMouseover) { this.Rect = rect; this.IsMouseover = isMouseover; this.IsSelected = isSelected; this.unit = unit; }
public void AddTool(GridBoxType type, Unit unit, Rectangle rect) { switch (type) { case GridBoxType.Enemy: enemyTools.Add(new ToolEntity(unit, rect, false, false)); break; case GridBoxType.Landscape: landscapeTools.Add(new ToolEntity(unit, rect, false, false)); break; case GridBoxType.Obstruction: obstructionTools.Add(new ToolEntity(unit, rect, false, false)); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + type.ToString()); } }
public void addUnit(GridBoxType gridType, string name, Unit unit) { switch (gridType) { case GridBoxType.Enemy: enemyTools[name] = unit; enemyNameList.Add(name); break; case GridBoxType.Landscape: landscapeTools[name] = unit; landscapeNameList.Add(name); break; case GridBoxType.Obstruction: obstructionTools[name] = unit; obstructionNameList.Add(name); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public void MouseAction(Point pos, MouseState state) { if (state.LeftButton == ButtonState.Pressed) { foreach (TabEntity tab in Tabs) { if (tab.Rect.Contains(pos)) { tab.IsSelected = true; currentTab = tab.Type; } else tab.IsSelected = false; } if (ToolTray.Rect.Contains(pos)) { foreach (ToolEntity tool in ToolTray.getTools(currentTab)) { if (tool.Rect.Contains(pos)) { tool.IsSelected = true; currentUnit = tool.Unit; } else tool.IsSelected = false; } } } }
public void LoadTool(GridBoxType type, string name, Texture2D texture, Color color) { Console.WriteLine("Now Loading " + name); Unit unit = new Unit(color, texture); Units.addUnit(type, name, unit); }