public Cell(Point position, int size, TypeCell type, Graphics owner) { this.position = position; this.size = size; this.type = type; this.owner = owner; }
private Unit CreateUnit(UnitParametrs param, int x, int y, TypeCell type, int level) { Unit unit = new Unit(param.stats, map, x, y, type, param.ID, level); CreateUnit(unit, param.model, param); return(unit); }
public Node GetNode(TypeCell type, int x, int y) { Unit unit = GetUnit(type, x, y, 8); if (unit == null) { return(null); } int r = 1; while (r <= 8) { for (int i = unit.X - r; i <= unit.X + r; i++) { for (int j = unit.Y - r; j <= unit.Y + r; j++) { if (i >= 0 && i < 8 && j >= 0 && j < 8) { if (Grid[i, j].OnMove()) { return(Grid[i, j]); } } } } r++; } return(null); }
public Unit GetUnit(TypeCell type, int x, int y, int range) { int r = 1; while (r <= range) { for (int i = x - r; i <= x + r; i++) { for (int j = y - r; j <= y + r; j++) { if (i >= 0 && i < 8 && j >= 0 && j < 8) { Unit unit = (Unit)Grid[i, j].Cell; if (unit == null) { continue; } if (unit.typeCell != type && unit.CheckToDamage()) { return(unit); } } } } r++; } return(null); }
static void AddCell(GridCoord coord, TypeCell type) { if (!cells.Exists((c) => c.coord == coord)) { cells.Add(new CellData(coord, type)); } }
public Unit(UnitStats param, Map map, int x, int y, TypeCell type, int id, int level = 1) { dead = false; Level = level; this.map = map; stats = param; CreateXY(x, y); typeCell = type; ID = id; }
private void SetImage() { TypeCell = currentLevel.GetRandomTypeCell(); cellImage.sprite = TypeCell.GetSprite(); }
public CellData(GridCoord coord, TypeCell type) { this.coord = coord; this.type = type; this.position = new Vector3(coord.x * Generator.sizeCell, 1, coord.z * Generator.sizeCell); }
private string GetSymbolByCellType(TypeCell type) { string res = ""; switch (type) { case TypeCell.BorderLeftUp: Console.ForegroundColor = ConsoleColor.White; res = "╔"; break; case TypeCell.BorderRigthUp: Console.ForegroundColor = ConsoleColor.White; res = "╗"; break; case TypeCell.BorderMidVert: Console.ForegroundColor = ConsoleColor.White; res = "║"; break; case TypeCell.BorderMidHor: Console.ForegroundColor = ConsoleColor.White; res = "══"; break; case TypeCell.BorderLeftDown: Console.ForegroundColor = ConsoleColor.White; res = "╚"; break; case TypeCell.BorderRigthDown: Console.ForegroundColor = ConsoleColor.White; res = "╝"; break; case TypeCell.MuffShot: Console.ForegroundColor = ConsoleColor.White; res = "░░"; break; case TypeCell.HiddenShip: Console.ForegroundColor = ConsoleColor.Cyan; res = "██"; break; case TypeCell.DamagetShip: Console.ForegroundColor = ConsoleColor.Magenta; res = "▓▓"; break; case TypeCell.KilledShip: Console.ForegroundColor = ConsoleColor.Red; res = "██"; break; default: Console.ForegroundColor = ConsoleColor.Blue; res = " ~"; break; } return(res); }
/// <summary> /// смена типа ячейки на цифру количесва мин вокруг ячейки /// </summary> /// <param name="count">количество мин вокруг</param> public void AddNumber(int count) { type = (TypeCell)count; }
/// <summary> /// устанавливает мину в ячейку /// </summary> public void AddMine() { type = TypeCell.Mine; }