Exemplo n.º 1
0
    private void AddVoyd(VoydData data)
    {
        Voyd prop = new Voyd(this, data);

        allObjects.Add(prop);
        objectsAddedThisMove.Add(prop);
    }
Exemplo n.º 2
0
 // ----------------------------------------------------------------
 //  Initialize
 // ----------------------------------------------------------------
 override public void Initialize(BoardView _myBoardView, BoardObject bo)
 {
     myVoyd = bo as Voyd;
     base.Initialize(_myBoardView, bo);
 }
Exemplo n.º 3
0
    public static TranslationInfo GetTranslationInfo(Board b, Vector2Int from, Vector2Int dir)
    {
        Vector2Int to        = from + dir;
        Vector2Int dirOut    = dir;
        Vector2Int dirIn     = Vector2Int.Opposite(dirOut);
        int        chirH     = 1;
        int        chirV     = 1;
        int        sideDelta = 0;

        // Wrap!
        if (to.x < 0)
        {
            if (b.DoWrapH)
            {
                to.x += b.NumCols;
            }
            if (b.WrapH == WrapTypes.Flip)
            {
                to.y   = b.NumRows - 1 - to.y;
                chirV *= -1;
            }
        }
        else if (to.x >= b.NumCols)
        {
            if (b.DoWrapH)
            {
                to.x -= b.NumCols;
            }
            if (b.WrapH == WrapTypes.Flip)
            {
                to.y   = b.NumRows - 1 - to.y;
                chirV *= -1;
            }
            if (b.WrapH == WrapTypes.CW)
            {
                to = new Vector2Int(to.y, b.NumRows - 1);
                sideDelta++;
                dirOut = Vector2Int.CW(dir);
            }
        }
        if (to.y < 0)
        {
            if (b.DoWrapV)
            {
                to.y += b.NumRows;
            }
            if (b.WrapV == WrapTypes.Flip)
            {
                to.x   = b.NumCols - 1 - to.x;
                chirH *= -1;
            }
        }
        else if (to.y >= b.NumRows)
        {
            if (b.DoWrapV)
            {
                to.y -= b.NumRows;
            }
            if (b.WrapV == WrapTypes.Flip)
            {
                to.x   = b.NumCols - 1 - to.x;
                chirH *= -1;
            }
            if (b.WrapH == WrapTypes.CW)
            {
                to = new Vector2Int(b.NumCols - 1, to.x);
                sideDelta--;
                dirOut = Vector2Int.CCW(dir);
            }
        }
        // Voyd? Recurse!!
        Voyd voyd = GetOccupant(b, to) as Voyd;

        if (voyd != null && voyd.IsOn)
        {
            voyd.OnPassedThrough();
            return(GetTranslationInfo(b, to, dirOut)); // TODO: Keep the whole "from" thing.
        }

        // Return!
        return(new TranslationInfo {
            from = from,
            to = to,
            dirOut = dirOut,
            dirIn = dirIn,
            sideDelta = sideDelta,
            chirDeltaH = chirH,
            chirDeltaV = chirV,
        });
    }