예제 #1
0
 public void HamsterLeft()
 {
     _fieldController.CellAdded(this);
     _hamster.transform.SetParent(null);
     _hamster.SetCell(null);
     _hamster = null;
 }
예제 #2
0
    public void SetIj(FieldController fieldController, HexCell[,] field, int i, int j)
    {
        _fieldController = fieldController;

        _i = i;
        _j = j;
        _fieldController.CellAdded(this);

        for (var d = 0; d < (int)Directions.Size; d++)
        {
            var     nbrPos = DesideIj((Directions)d);
            HexCell cell   = null;
            if (nbrPos.x >= 0 && nbrPos.x < field.GetLength(0))
            {
                if (nbrPos.y >= 0 && nbrPos.y < field.GetLength(1))
                {
                    cell = field[(int)nbrPos.x, (int)nbrPos.y];
                    AddNeighbour(cell, (Directions)d);
                }
            }

            if (cell == null)
            {
                fieldController.СellBecameDirectionEdge(this, (Directions)d);
            }
        }

        transform.GetChild(0).gameObject.GetComponent <Text>().text = i + ";" + j;
    }