示例#1
0
 public Cell(Point position, int size, TypeCell type, Graphics owner)
 {
     this.position = position;
     this.size     = size;
     this.type     = type;
     this.owner    = owner;
 }
示例#2
0
    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);
    }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 static void AddCell(GridCoord coord, TypeCell type)
 {
     if (!cells.Exists((c) => c.coord == coord))
     {
         cells.Add(new CellData(coord, type));
     }
 }
示例#6
0
 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;
 }
示例#7
0
 private void SetImage()
 {
     TypeCell         = currentLevel.GetRandomTypeCell();
     cellImage.sprite = TypeCell.GetSprite();
 }
示例#8
0
 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);
 }
示例#9
0
        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);
        }
示例#10
0
 /// <summary>
 /// смена типа ячейки на цифру количесва мин вокруг ячейки
 /// </summary>
 /// <param name="count">количество мин вокруг</param>
 public void AddNumber(int count)
 {
     type = (TypeCell)count;
 }
示例#11
0
 /// <summary>
 /// устанавливает мину в ячейку
 /// </summary>
 public void AddMine()
 {
     type = TypeCell.Mine;
 }