예제 #1
0
    public void InitialPress(Vector3 pressLocation)
    {
        TileSlot tileSlot = RaycastForTileSlot(pressLocation);

        if (tileSlot == null || tileSlot.GetItemType() == ColorPalette.None)
        {
            return;
        }
        lastHoverHeld = tileSlot;
        pathModel.SetInitialSlot(tileSlot);
    }
예제 #2
0
    public void AttemptAddPath(TileSlot newTile)
    {
        ResetPathColor();
        // Don't add to empty path
        if (path.Count == 0)
        {
            return;
        }
        // No doubling back
        if (path.Count > 1 && path[path.Count - 2] == newTile)
        {
            return;
        }

        ColorPalette itemType = newTile.GetItemType();
        TileSlot     lastSlot = path[path.Count - 1];

        // Item must be the same color as the path, or must be 'all'
        if (itemType != ColorPalette.All && (itemType != pathColor && pathColor != ColorPalette.All))
        {
            return;
        }
        // If last item, remove last item
        if (lastSlot == newTile && path.Count > 1)
        {
            path.RemoveAt(path.Count - 1);
            ResetPathColor();
            AndroidVibrate.Vibrate(40);
            return;
        }

        // Don't add more items on loop
        if (ContainsLoop())
        {
            return;
        }
        // Check if the new tile is adjacent our current one.
        if (!lastSlot.adjacentTiles.Contains(newTile))
        {
            return;
        }
        AddToPath(newTile);
        if (ContainsLoop())
        {
            specialActions.EmphasizeColor(pathColor);
            AndroidVibrate.Vibrate(new long [] { 0, 40, 20, 40 }, -1);
        }
        // if(ContainsLoop()) AndroidVibrate.Vibrate(70);
        else
        {
            AndroidVibrate.Vibrate(30);
        }
    }
예제 #3
0
    public void SetInitialSlot(TileSlot initialSlot)
    {
        ColorPalette itemType = initialSlot.GetItemType();

        path.Clear();
        if (itemType == ColorPalette.None)
        {
            return;
        }
        AddToPath(initialSlot);
        pathColor = itemType;
        AndroidVibrate.Vibrate(40);
    }