示例#1
0
    public virtual int ClearLine(Hex hex)
    {
        //count up to 20 just to be sure
        //could use a while loop but I don't like to
        Hex h = startHex;

        //h.SetWillClear(0);
        for (int i = 0; i < 20; i++)
        {
            //if no hex, return
            if (h == null)
            {
                isDone = true;
                buttonTool.EndUse();
                //EndUse();
                return(i);
            }
            int hexVal = h.GetVal() - 1;

            //check if they are the same

            if (hexVal != GetVal())
            {
                //check if it can absorb
                if (CanAbsorb(hexVal, GetVal()))
                {
                    //mix
                    //h.SetVal(Calc.GetAbsorb(hexVal+1,GetVal()));//TODO delay the mixing
                    //h.SetWillMix(0.1f*(i+1));
                    //h.UpdateColor();
                    h.Absorb(Calc.GetAbsorb(h.GetVal(), GetVal()), this, i * 0.1f);
                    numToAbsorb++;
                    //h.LightUp(false);
                }
                else
                {
                    //return if can't mix
                    isDone = true;
                    buttonTool.EndUse();
                    //EndUse();
                    return(i);
                }
            }
            else
            {
                //if they are the same
                //h.SetWillClear(0.1f*(i+1));
                //h.Clear(1,this);
                h.Absorb(0, this, i * 0.1f);
                numToAbsorb++;
            }
            h = h.GetNeighbor(xdir, ydir);
        }
        return(10);
    }
示例#2
0
    public void CheckPreviousHex()
    {
        int hexVal = previousHex.GetVal() - 1;

        if (CheckCanClear(hexVal))
        {
            previousHex.Clear(1, this);
            return;
        }
        int stealVal = CanSteal(hexVal);

        previousHex.Absorb(stealVal + 1, this);
    }
示例#3
0
    public override void Activate(Hex h)
    {
        //diamond nova adds its color
        int hexVal = h.GetVal() - 1;


        if (hexVal == GetVal())
        {
            h.Clear(1, this);
            numToAbsorb++;
            return;
            //don't mix, add to the list so it doesn't get checked again
        }
        //h.SetVal(Calc.GetAbsorb(h.GetVal(),GetVal()));
        h.Absorb(Calc.GetAbsorb(h.GetVal(), GetVal()), this);
        numToAbsorb++;
        //h.Clear();
    }