Esempio n. 1
0
    //Functions for movement and the display of it
    #region Movement

    /// <summary>
    /// Shows all the possible moves for the character.
    /// </summary>
    /// <param name="attacking"></param>
    public void FindAllMoveTiles(bool attacking)
    {
        battleMap.ResetMap();
        Queue <MapTile> process = new Queue <MapTile>();

        process.Enqueue(currentTile);
        currentTile.distance   = 0;
        currentTile.parent     = null;
        currentTile.selectable = true;
        currentTile.target     = true;

        SearchInfo info = new SearchInfo()
        {
            tactics      = this,
            maxMoveSpeed = GetMoveSpeed(),
            oneTurnSpeed = GetMoveSpeed(),

            wpnRange = inventory.GetReach(ItemCategory.WEAPON),
            staff    = inventory.GetReach(ItemCategory.SUPPORT),

            showAttack = true,
            isDanger   = attacking,
            //isBuff = false
        };

        if (info.wpnRange.max > 0)
        {
            battleMap.ShowAttackTiles(currentTile, info.wpnRange, faction, info.isDanger);
        }
        if (info.staff.max > 0)
        {
            info.isBuff = (inventory.GetFirstUsableItemTuple(ItemCategory.SUPPORT) != null);
            battleMap.ShowSupportTiles(currentTile, info.staff, faction, info.isDanger, info.isBuff);
        }

        while (process.Count > 0)
        {
            MapTile tile = process.Dequeue();
            if (tile.distance >= (GetMoveSpeed()))
            {
                continue;
            }

            tile.FindNeighbours(process, tile.distance, info);
        }
    }