Example #1
0
    protected override void DisplayInGrid(State currentState, TilemapComponent tilemap)
    {
        if (completed)
        {
            var stateData = (AllySelectedState)currentState;

            TilemapComponent.ClearAllHighlightsFromGrid(tilemap.grid);
            stateData.attackRange = TilemapComponent.GenerateAttackRange(tilemap.grid, source);
            stateData.moveRange   = TilemapComponent.GenerateMoveRange(tilemap.grid, source);
            TilemapComponent.RefreshGridHighlights(tilemap.grid, stateData.attackRange, Tile.HighlightTypes.Attack);
            TilemapComponent.RefreshGridHighlights(tilemap.grid, stateData.moveRange, Tile.HighlightTypes.Move);
        }
        else
        {
            // selecting a tile
            if (selectedTile.currentHighlights.Contains(Tile.HighlightTypes.Skill))
            {
                selectedTile.currentHighlights.Remove(Tile.HighlightTypes.Skill);
                selectedTile.currentHighlights.Add(Tile.HighlightTypes.SkillSelect);
            }
            // deselecting a tile
            else
            {
                selectedTile.currentHighlights.Remove(Tile.HighlightTypes.SkillSelect);
                selectedTile.currentHighlights.Add(Tile.HighlightTypes.Skill);
            }
        }
    }
Example #2
0
    protected override void DisplayInGrid(State currentState, TilemapComponent tilemap)
    {
        var stateData = (AllySelectedState)currentState;

        TilemapComponent.ClearAllHighlightsFromGrid(tilemap.grid);

        stateData.attackRange = TilemapComponent.GenerateAttackRange(tilemap.grid, source);
        stateData.moveRange   = TilemapComponent.GenerateMoveRange(tilemap.grid, source);

        TilemapComponent.RefreshGridHighlights(tilemap.grid, stateData.attackRange, Tile.HighlightTypes.Attack);
        TilemapComponent.RefreshGridHighlights(tilemap.grid, stateData.moveRange, Tile.HighlightTypes.Move);
    }
Example #3
0
    public void DeactivateGrid()
    {
        activated = false;
        waiting   = true;
        GridUtils.FlattenGridTiles(tilemap.grid)
        .Where(tile => !tile.disabled).ToList()
        .ForEach(tile => DeactivateTile(tile));

        TilemapComponent.ClearAllHighlightsFromGrid(tilemap.grid);

        factions.ToList()
        .Where(faction => faction.isHostileFaction).ToList()
        .ForEach(faction => {
            faction.entities
            .Where(entity => entity.outOfHP).ToList()
            .ForEach(entity => {
                var rand = new System.Random();
                GameObject onDeathPrefab = null;
                if (rand.Next(2) == 0)
                {
                    onDeathPrefab = entity.corpse;
                }
                else
                {
                    onDeathPrefab = threadPrefabs.OrderBy(_ => rand.Next()).First();
                }
                Instantiate(onDeathPrefab, entity.transform.position, Quaternion.identity);
            });
        });

        factions.ToList().ForEach(faction => {
            faction.entities.ForEach(entity => entity.RemoveFromGrid());
        });
        factions = new Queue <Faction>();

        skillMenu.SetActive(false);
    }
Example #4
0
 protected override void DisplayInGrid(State currentState, TilemapComponent tilemap)
 {
     TilemapComponent.ClearAllHighlightsFromGrid(tilemap.grid);
     TilemapComponent.RefreshGridHighlights(tilemap.grid, validTiles, Tile.HighlightTypes.Teleport);
 }
Example #5
0
 protected override void DisplayInGrid(State currentState, TilemapComponent tilemap)
 {
     TilemapComponent.ClearAllHighlightsFromGrid(tilemap.grid);
 }