Ejemplo n.º 1
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);
        }
    }
Ejemplo n.º 2
0
    public static void Play(VibrateType type)
    {
        if (Vibro)
        {
#if UNITY_EDITOR
#elif UNITY_IOS && VIBRO
            iosVibrate.iosStartCustomVibrate((int)type);
#elif UNITY_ANDROID
            AndroidVibrate.Play(type);
#endif
        }
    }
Ejemplo n.º 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);
    }