public bool SlotAvailable(ICADslot slot, int X, int Y) { int xLimit = X + slot.Size.x; int yLimit = Y + slot.Size.y; if (xLimit > CurSize || yLimit > CurSize) { return(false); } for (int i = X; i < xLimit; i++) { for (int j = Y; j < yLimit; j++) { if (slot.Grid.rows[i - X].row[j - Y] && Grid[i, j].status != GridSquareStatus.Available) { return(false); } } } return(true); }
public void UnequipSlot(ICADslot slot, int X, int Y) { int xLimit = X + slot.Size.x; int yLimit = Y + slot.Size.y; for (int i = X; i < xLimit; i++) { for (int j = Y; j < yLimit; j++) { Grid[i, j].status = GridSquareStatus.Available; } } }
public void addSlotToCAD(ICADslot slot, SkillsManager Mgr, int X, int Y) { if (SlotAvailable(slot, X, Y)) { InstalledSlots.Add(slot); slot.AddAbility(Mgr, new Vector2Int(X, Y)); int xLimit = X + slot.Size.x; int yLimit = Y + slot.Size.y; for (int i = X; i < xLimit; i++) { for (int j = Y; j < yLimit; j++) { Grid[i, j].status = GridSquareStatus.Occupied; if (Grid[i, j].Type == TypeOfGridSquare.CommandLine) { slot.OnCommandLine = true; } } } } }