Example #1
0
 //Highlights recorded movement path for character, before confirmation.
 public void TargetPath(List <Vector3Int> path, HighlightTiles.TileType type)
 {
     foreach (Vector3Int l in path)
     {
         targets.ChangeTile(l, type);
     }
 }
Example #2
0
    //may be implemented properly in the furture, not important right now.
    void Chain(Vector3Int origin, HighlightTiles.TileType t)
    {
        HashSet <Vector3Int> explored = new HashSet <Vector3Int>();
        Queue <Vector3Int>   frontier = new Queue <Vector3Int>();

        targets.ChangeTile(origin, t);
        if (characterLocations[origin.x, origin.y])
        {
            frontier.Enqueue(origin);
        }
        while (frontier.Count > 0)
        {
            Vector3Int current = frontier.Dequeue();
            if (characterLocations[origin.x, origin.y])
            {
                targets.ChangeTile(current, t);
                explored.Add(current);
                foreach (Vector3Int n in neightbors)
                {
                    Vector3Int next = n + current;
                    if (WithinMapBounds(next) && !explored.Contains(next))
                    {
                        frontier.Enqueue(next);
                    }
                }
            }
        }
    }
Example #3
0
    //Highlights the tilemap for movement and card range.
    public void Highlight(Vector3 pos, Card.RangeType rt, int area, HighlightTiles.TileType type, List <Card.TargetType> validTypes)
    {
        Vector3Int location = WorldToCellSpace(pos);

        switch (rt)
        {
        case Card.RangeType.Area:
            highlights.FloodFill(location, area, type, validTypes);
            break;

        case Card.RangeType.Row:
        case Card.RangeType.Cross:
            highlights.FillCross(location, area, type, validTypes);
            break;
        }
    }
Example #4
0
    //highlights tiles when moused over a potential target in red.
    public void Target(Vector3 pos, Card.RangeType rt, int area, HighlightTiles.TileType type, List <Card.TargetType> validTypes)
    {
        Vector3Int origin = WorldToCellSpace(pos);

        targets.Clear();
        if (highlights.Contains(origin))
        {
            switch (rt)
            {
            case Card.RangeType.Area:
                targets.FloodFill(origin, area, type, validTypes);
                break;

            case Card.RangeType.Row:
                targets.FillRow(origin, area, type, validTypes);
                break;

            case Card.RangeType.Cross:
                targets.FillCross(origin, area, type, validTypes);
                break;
            }
        }
    }
 //  Highlights the tile map to indicate possible attack targets
 public void HighlightTargets(Card.RangeType rt, int area, HighlightTiles.TileType t, List <Card.TargetType> validTargets)
 {
     map.Highlight(currentCharacter.transform.position, rt, area, t, validTargets);
 }