public async Task <IActionResult> Save(BlankTile tile) { if (ModelState.IsValid) { return(await SaveBaseTile(ConfigStore, tile)); } return(View("Add", tile)); }
public async Task <IActionResult> Save([FromRoute] string page, BlankTile tile) { if (ModelState.IsValid) { return(await SaveBaseTile(page, ConfigStore, tile)); } return(View("Add", tile)); }
private BlankTile GetValidAndMountedTile() { BlankTile tile = GetValidTile(); if (tile == null || tile.Slot != null) { return(null); } return(tile); }
public void InstallGenerator() { BlankTile tile = GetValidAndEmptyTile(); if (tile == null) { return; } // build generator if BlankTile has empty slot tile.Slot = Instantiate(generatorPrefab, tile.transform); tile.Slot.Install(player.team); }
public void InstallCannon() { BlankTile tile = GetValidAndEmptyTile(); if (tile == null) { return; } // build cannon if BlankTile has empty slot tile.Slot = Instantiate(cannonPrefab, tile.transform); tile.Slot.Install(player.team); }
private BlankTile GetValidTile() { BlankTile tile = null; // check if player has valid tile if (player.currentSector != null) { if (player.currentSector.GetType() == typeof(BlankTile)) { tile = player.currentSector as BlankTile; } } return(tile); }
public void DismountFacility() { BlankTile tile = GetValidTile(); if (tile == null) { return; } if (tile.Slot == null) { return; } tile.Slot.Dismount(player.team); }
private void OnPlayerStaysInTile(Sector tile) { if (tile.GetType() == typeof(BlankTile)) { BlankTile bt = tile as BlankTile; if (bt.Slot == null) { BtnBuildCannon.gameObject.SetActive(true); BtnBuildGen.gameObject.SetActive(true); BtnDismount.gameObject.SetActive(false); } else { BtnBuildCannon.gameObject.SetActive(false); BtnBuildGen.gameObject.SetActive(false); BtnDismount.gameObject.SetActive(true); } } }
public Tile[,] ParseImage(Color[,] colorData) { Tile[,] Tiles = new Tile[40, 24]; for (int x = 0; x < 40; x++) for (int y = 0; y < 24; y++) { //Assign blank tiles for initialisation Tiles[x, y] = new BlankTile(new Vector2(x, y)); } for (int x = 0; x < 40; x++) { for (int y = 0; y < 24; y++) { if (colorData[x, y] == Color.Black) { Tiles[x, y] = new Wall(new Vector2(x, y)); } } } return Tiles; }