예제 #1
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder(rowCount * (columnCount + 1));

            for (int i = 0; i < rowCount; i++)
            {
                builder.Append(i).Append(" ");
                for (int j = 0; j < columnCount; j++)
                {
                    BlockColor blockColor  = blocks[i, j].color;
                    string     firstLetter = blockColor.ToString().Substring(0, 1);
                    builder.Append(firstLetter);
                }
                builder.AppendLine();
            }
            builder.AppendLine();
            builder.Append("  ");
            for (int i = 0; i < columnCount; i++)
            {
                builder.Append(i);
            }
            builder.AppendLine();

            return(builder.ToString());
        }
예제 #2
0
        public override void Render(Graphics map, VirtualMap <char> solids)
        {
            List <Bitmap> images = Gameplay.GetAllImages("objects/resortclutter/" + Color.ToString());

            int widthTiles             = Width / 8;
            int heightTiles            = Height / 8;
            VirtualMap <bool> occupied = new VirtualMap <bool>(widthTiles, heightTiles, false);
            int y = (int)Position.Y;

            for (int j = 0; j < heightTiles; j++)
            {
                int x = (int)Position.X;
                for (int i = 0; i < widthTiles; i++)
                {
                    if (occupied[i, j])
                    {
                        x += 8;
                        continue;
                    }

                    int maxWidth = 1;
                    int maxSize  = Math.Min(heightTiles - j, widthTiles - i);
                    maxSize += i;
                    for (int k = i + 1; k < maxSize; k++)
                    {
                        if (occupied[k, j])
                        {
                            break;
                        }
                        maxWidth++;
                    }

                    Bitmap img = null;
                    do
                    {
                        img = Util.Random.Choose(images);
                    } while (img.Width / 8 > maxWidth);

                    maxWidth = i + img.Width / 8;
                    int height = j + img.Height / 8;
                    for (int m = j; m < height; m++)
                    {
                        for (int k = i; k < maxWidth; k++)
                        {
                            occupied[k, m] = true;
                        }
                    }

                    map.DrawImage(img, x, y);
                    x += 8;
                }
                y += 8;
            }

            for (int i = 0; i < images.Count; i++)
            {
                images[i].Dispose();
            }
        }
예제 #3
0
 public void Dump2()
 {
     Console.Error.WriteLine("Block Color #" + BlockNbr.ToString() + " : " + BlockColor.ToString());
     Console.Error.WriteLine("Stones:");
     Console.Error.WriteLine(Members.ToString());
     Console.Error.WriteLine("Liberties:");
     Console.Error.WriteLine(Liberties.ToString());
 }
예제 #4
0
        public override void Render(Graphics map, VirtualMap <char> solids)
        {
            Bitmap img  = Gameplay.GetImage("objects/resortclutter/clutter_button00");
            Bitmap icon = Gameplay.GetImage("objects/resortclutter/icon_" + Color.ToString());

            if (img == null)
            {
                return;
            }

            map.DrawImage(img, Position.X - 32, Position.Y - 32);
            map.DrawImage(icon, Position.X + icon.Width / 2, Position.Y);
            img.Dispose();
        }
예제 #5
0
        public void Dump()
        {
            Console.Error.WriteLine("Block Color #" + BlockNbr.ToString() + " : " + BlockColor.ToString());

            for (int y = Board.BoardSize; y > 0; y--)
            {
                Console.Error.Write(y);

                if (y < 10)
                {
                    Console.Write(" ");
                }

                Console.Error.Write(" : ");

                for (int x = 0; x < Board.BoardSize; x++)
                {
                    int lIndex = Board.Coord.At(x, y - 1);

                    if (IsMember(lIndex))
                    {
                        Console.Error.Write(BlockColor.ToString());
                    }
                    else if (IsLiberty(lIndex))
                    {
                        Console.Error.Write('*');
                    }
                    else if (IsEnemy(lIndex))
                    {
                        Console.Error.Write(BlockColor.Opposite.ToString());
                    }
                    else
                    {
                        Console.Error.Write('.');
                    }
                }

                Console.Error.WriteLine();
            }
            Console.Error.Write("     ");
            Console.Error.WriteLine("ABCDEFGHJKLMNOPQURS".Substring(0, Board.BoardSize));
        }
예제 #6
0
    void ChangeBlock(BlockColor bc)
    {
        Debug.Log(bc.ToString());
        switch (now_color)
        {
        case BlockColor.RED:
            SetColorandCollider(ref reddata, true);
            break;

        case BlockColor.GREEN:
            SetColorandCollider(ref greendata, true);
            break;

        case BlockColor.BLUE:
            SetColorandCollider(ref bluedata, true);
            break;
        }
        now_color = bc;
        switch (now_color)
        {
        case BlockColor.None:
            m_wispspr.color = new Color(1, 1, 1, 1);
            break;

        case BlockColor.RED:
            SetColorandCollider(ref reddata, false);
            m_wispspr.color = new Color(1, 0, 0, 1);
            break;

        case BlockColor.GREEN:
            SetColorandCollider(ref greendata, false);
            m_wispspr.color = new Color(0, 1, 0, 1);
            break;

        case BlockColor.BLUE:
            SetColorandCollider(ref bluedata, false);
            m_wispspr.color = new Color(0, 0, 1, 1);
            break;
        }
    }
예제 #7
0
    public void StartNewRound()
    {
        isGameActive = true;

        for (int i = 0; i < 3; i++)
        {
            //Destroy old round blocks.
            Destroy(blocks[i]);
            blocks[i] = GameObject.Instantiate(blockPrefab, blockSpawnPosition.position + new Vector3(0, 0, .3f * i), Quaternion.identity);
            blocks[i].GetComponent <BlockProperties>().InitBlock();
        }

        int randomBlockIndex = Random.Range(0, blocks.Length);

        desiredColor = blocks[randomBlockIndex].GetComponent <BlockProperties>().color;

        monitorText.text = "Place a " + desiredColor.ToString() + " cube in the container";

        //All same color.
        //All same shape.
        //Only voice for instructions.
        //Only text for instructions.
    }
    private string GenerateFileName(int rank, BlockColor color)
    {
        string colorInitial = char.ToLower(color.ToString()[0]).ToString();

        return("block_kari_" + colorInitial + rank);
    }
예제 #9
0
 public void Init(BlockColor c)
 {
     Color = c;
     name  = Color.ToString();
 }
예제 #10
0
 public void Init(BlockColor c, int tileLayer)
 {
     TileLayer = tileLayer;
     Color     = c;
     name      = Color.ToString();
 }
예제 #11
0
    public override string ObjectiveString(float progress)
    {
        string str = "";

        str = string.Format("{0} / {1} {2}{3} blocks cleared.", progress, AmountToClear, BlockColorToClear.ToString(), AmountToClear > 1 ? "s" : "");

        return(str);
    }