public void SetPokemon(int pokemonID) { building.sprite = Pokedex.instance[pokemonID - 1].icon; _pokemonID = pokemonID; building.gameObject.SetActive(true); ODData.UpdateCell(x, y, _pokemonID); }
public void CreateCellsNearBy(int x, int y) { for (int i = 0; i < 4; i++) { int x1 = x + addedValues[i, 0]; int y1 = y + addedValues[i, 1]; if (x1 >= 0 && x1 < shipSize && y1 >= 0 && y1 < shipSize) { if (SpaceShip.shipCells[x1, y1] == (int)CellType.CanNotBuy) { SpaceShip.shipCells[x1, y1] = (int)CellType.CanBuy; CreateCanBuyBorder(x1, y1); ODData.UpdateCell(x1, y1, (int)CellType.CanBuy); } } } }
public void BuyCell() { if (Player.instance.TryToAford(new Dictionary <int, float>() { { 1, _price } })) { SetCellType(CellType.Buyed); SpaceShip.shipCells[x, y] = (int)CellType.Buyed; SpaceShip.ownedCellNum++; ODData.UpdateCell(x, y, (int)CellType.Buyed); SpaceShip.instance.MoveCellToBuyedList(gameObject); SpaceShip.instance.CreateCellsNearBy(x, y); SpaceShip.instance.UpdateAllCellPrice(); OnClickCell(); } else { print("金币不够"); } }