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));
        }
Example #3
0
    private BlankTile GetValidAndMountedTile()
    {
        BlankTile tile = GetValidTile();

        if (tile == null || tile.Slot != null)
        {
            return(null);
        }

        return(tile);
    }
Example #4
0
    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);
    }
Example #5
0
    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);
    }
Example #6
0
    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);
    }
Example #7
0
    public void DismountFacility()
    {
        BlankTile tile = GetValidTile();

        if (tile == null)
        {
            return;
        }
        if (tile.Slot == null)
        {
            return;
        }
        tile.Slot.Dismount(player.team);
    }
Example #8
0
 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);
         }
     }
 }
Example #9
0
        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;
        }