示例#1
0
    public BlockExploration GetBetterBlockPotential()
    {
        int counterTilesUnknow = 0, i, j, iLimit = this.blocks.GetLength(0), jLimit = this.blocks.GetLength(1);;
        BlockExploration bestBlock = null, blockMostUnknow = null;

        if (this.idPlayer == 0)
        {
            for (i = 0; i < iLimit; i++)
            {
                for (j = 0; j < jLimit; j++)
                {
                    this.blocks[i, j].CalculatePotential();

                    if (counterTilesUnknow < this.blocks[i, j].count)
                    {
                        counterTilesUnknow = this.blocks[i, j].count;
                        blockMostUnknow    = this.blocks[i, j];
                    }

                    if (this.blocks[i, j].unknown && (bestBlock == null || this.blocks[i, j].potential > bestBlock.potential))
                    {
                        bestBlock = this.blocks[i, j];
                    }
                }
            }
        }
        else
        {
            for (i = iLimit - 1; i >= 0; i--)
            {
                for (j = jLimit - 1; j >= 0; j--)
                {
                    this.blocks[i, j].CalculatePotential();

                    if (counterTilesUnknow < this.blocks[i, j].count)
                    {
                        counterTilesUnknow = this.blocks[i, j].count;
                        blockMostUnknow    = this.blocks[i, j];
                    }

                    if (this.blocks[i, j].unknown && (bestBlock == null || this.blocks[i, j].potential > bestBlock.potential))
                    {
                        bestBlock = this.blocks[i, j];
                    }
                }
            }
        }

        if (bestBlock == null)
        {
            bestBlock = blockMostUnknow;
        }

        return(bestBlock);
    }
示例#2
0
    public void ExploreMap(List <Unit> units)
    {
        if (units.Count == 0)
        {
            return;
        }

        BlockExploration block = this.player.fog.GetBetterBlockPotential();

        if (block != null)
        {
            block.unknown = false;
            player.orders.Add(new MovementOrder(this.player.id, units, block.GetPosition(), false));
        }
        else
        {
            Debug.Log(this.player.name + ": Todos os blocos foram descobertos.");
        }
    }