Ejemplo n.º 1
0
    void DropNewDots()
    {
        if (!dropNewDots)
        {
            return;
        }

        if (CountDots() >= columns * rows)
        {
            EventManager.OnGameOver();
        }

        int leftToDropCount = maxDrop;

        var candidates = new List <DotScript>();
        var randomDots = new List <DotScript>(dots);

        randomDots.Shuffle <DotScript>();

        foreach (DotScript dot in randomDots)
        {
            if (leftToDropCount <= 0)
            {
                break;
            }

            if (dot && dot.color == DotScript.Type.Empty)
            {
                var possibleColors = new List <DotScript.Type>();

                if (ShouldDropQueen())
                {
                    possibleColors.Add(DotScript.Type.Queen);
                    leftToDropCount = 0;
                }
                else
                {
                    possibleColors.AddRange(
                        new List <DotScript.Type> {
                        DotScript.Type.Circle,
                        DotScript.Type.Square,
                        DotScript.Type.Diamond,
                        DotScript.Type.Star
                    }
                        );
                }

                var remainingColors = DropDotCheckRules(dot.currentX, dot.currentY, possibleColors);

                DotScript.Type color = DotScript.GetRandomColor(remainingColors);
                dot.SetType(color);
                leftToDropCount -= 1;
            }
        }
        UpdateConnections();
    }
Ejemplo n.º 2
0
 public FieldPattern(int x, int y, DotScript.Type type)
 {
     this.x    = x;
     this.y    = y;
     this.type = type;
 }