示例#1
0
文件: Cell.cs 项目: 51ch/Soko
 public Cell(int x, int y, cellType t)
 {
     xPos        = x;
     yPos        = y;
     this.Type   = t;
     this.isBusy = false;
 }
示例#2
0
 public Cell(Vector3 p, cellType c)
 {
     position = p;
     cellType = c;
     weight   = Random.Range(0, BoardManager.rows * BoardManager.columns);
     visited  = false;
 }
示例#3
0
文件: Cell.cs 项目: 51ch/Soko
 public Cell(int x, int y, cellType t, bool b)
 {
     xPos        = x;
     yPos        = y;
     this.Type   = t;
     this.isBusy = b;
 }
    public void GetRandomCellType(CellData currentCell)
    {
        int      randomIndex          = UnityEngine.Random.Range(0, allCellSprites.Length);
        Sprite   randomSpriteFromList = allCellSprites[randomIndex];
        cellType tempType             = (cellType)System.Enum.Parse(typeof(cellType), randomSpriteFromList.name);

        currentCell.cellType       = tempType;
        currentCell.assignedSprite = randomSpriteFromList;
    }
示例#5
0
        public Grid(int width, int height)
        {
            this.width  = width;
            this.height = height;
            // allocate memory for the gameInfo array
            gameInfo         = new cellType[width, height];
            gameInfoOriginal = new cellType[width, height];

            // initialize the gameInfo array
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    gameInfo[i, j]         = cellType.blank;
                    gameInfoOriginal[i, j] = cellType.blank;
                }
            }
        }
示例#6
0
        public bool Init(int _w, int _h, int _wNum, int _hNum, int[,] fieled)
        {
            if (_w < 0 || _h < 0)
            {
                return(false);
            }
            widthWindow  = _w;
            heightWindow = _h;
            width        = _wNum;
            height       = _hNum;

            dx = (widthWindow - netBorder * 2) / width;
            dy = (heightWindow - netBorder * 2) / height;

            gameFiled = new cellType[width][];
            for (int i = 0; i < width; i++)
            {
                gameFiled[i] = new cellType[height];
            }

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    gameFiled[i][j] = (cellType)fieled[i, j];
                }
            }


            conditionPen           = new Pen(Color.Yellow, 4);
            conditionPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            images    = new Image[7];
            images[0] = Image.FromFile("1.png");
            images[1] = Image.FromFile("2.png");
            images[2] = Image.FromFile("3.png");
            images[3] = Image.FromFile("4.png");
            images[4] = Image.FromFile("5.png");
            images[5] = Image.FromFile("6.png");
            images[6] = Image.FromFile("7.png");

            return(true);
        }
示例#7
0
    public void SetType(int type)
    {
        if (type == 0)
        {
            myType = cellType.empty;
        }

        if (type == 1)
        {
            myType = cellType.tree;
        }

        if (type == 2)
        {
            myType = cellType.fungi;
        }

        //Debug.Log("cell type is" + myType);
    }
示例#8
0
 public void setCellType(cellType c)
 {
     cellType = c;
 }
 var(cellType, content, isCellDateFormatted) = tuple;