예제 #1
0
    public override void OnTurnEnd(HexBoardTile tile)
    {
        HexBoardTile runTile = tile.adjTiles[((int)Hexinal.E)];

        int failsafe = 0;

        while (failsafe < 50)
        {
            failsafe++;
            if (runTile == null)
            {
                return;
            }
            else if (runTile.ReadElementID() == -1)
            {
                BoardOS.AddToEndTurnUpdateQueue(runTile, laserGE.id);
                return;
            }
            else if (runTile.ReadElementID() == laserGE.id)
            {
                runTile = runTile.adjTiles[((int)Hexinal.E)];
            }
            else
            {
                return;
            }
        }
        Debug.Log("failsafe triggered");
    }
예제 #2
0
    public override void OnTurnEnd(HexBoardTile tile)
    {
        List <HexBoardTile> visualUpdateTiles = new List <HexBoardTile>();
        HexBoardTile        eastTile          = tile.adjTiles[((int)Hexinal.E)];

        if (eastTile == null)
        {
            BoardOS.AddToEndTurnUpdateQueue(tile, -1);
        }
        else if (eastTile.ReadElementID() == -1)
        {
            BoardOS.AddToEndTurnUpdateQueue(tile, -1);
            BoardOS.AddToEndTurnUpdateQueue(eastTile, id);
        }
    }
예제 #3
0
    private void DropInventoryElement()
    {
        mouseElementSpriteRenderer.sprite = null;
        if (InventoryOS.request == null)
        {
            return;
        }

        if (BoardOS.TryUpdateElement(mouseElementTransform.position, InventoryOS.request.ReadID(), true))
        {
            HistoryManager.AddPresentToHistory(InventoryOS.ConfirmRequest());
        }
        else
        {
            InventoryOS.CancelRequest();
        }
    }
예제 #4
0
    public static bool CheckIfCurrentCanBeSubmitted()
    {
        //Debug.Log("PCheck Start");
        if (isSolved[currentPuzzleIndex] > 0)
        {
            return(false);
        }
        else
        {
            //Debug.Log("PCheck Not Solved");
            if (!puzzles[currentPuzzleIndex].CheckWinCondition())
            {
                return(false);
            }
            else
            {
                //Debug.Log(puzzles[currentPuzzleIndex].name);

                return(BoardOS.FindElementPattern(PuzzleShower.puzzle));
            }
        }
    }
예제 #5
0
    public void Undo(bool lightsUp)
    {
        if (currentPointOfTime < 0)
        {
            return;
        }
        //Debug.Log("Undo | " + currentPointOfTime);
        BoardOS.bvus.ForceComplete(lightsUp);

        if (inventoryHistory[currentPointOfTime] != null)
        {
            inventoryHistory[currentPointOfTime].UpdateAvailability(true);
        }
        for (int i = gridHistory[currentPointOfTime].Count - 1; i >= 0; i--)
        {
            GridChange change = gridHistory[currentPointOfTime][i];
            BoardOS.ForceChange(change.gridPos, change.originalElementID, lightsUp, false);
        }
        currentPointOfTime--;
        gridPresent.Clear();

        bRedo.interactable = true;
        bUndo.interactable = (currentPointOfTime >= 0);
    }
예제 #6
0
 public void Clear()
 {
     BoardOS.bvus.ForceComplete(true);
     while (currentPointOfTime >= 0)
     {
         if (inventoryHistory[currentPointOfTime] != null)
         {
             inventoryHistory[currentPointOfTime].UpdateAvailability(true);
         }
         for (int i = gridHistory[currentPointOfTime].Count - 1; i >= 0; i--)
         {
             GridChange change = gridHistory[currentPointOfTime][i];
             BoardOS.ForceChange(change.gridPos, -1, BoardOS.GetTileID(change.gridPos) != -1, false);
         }
         currentPointOfTime--;
     }
     gridPresent.Clear();
     gridHistory.Clear();
     inventoryHistory.Clear();
     bRedo.interactable   = false;
     bUndo.interactable   = false;
     bSubmit.interactable = false;
     bClear.interactable  = false;
 }
예제 #7
0
    public void Redo()
    {
        if (currentPointOfTime >= gridHistory.Count - 1)
        {
            return;
        }
        //Debug.Log("Redo | " + (currentPointOfTime + 1));
        BoardOS.bvus.ForceComplete(true);

        if (inventoryHistory[currentPointOfTime + 1] != null)
        {
            inventoryHistory[currentPointOfTime + 1].UpdateAvailability(false);
        }
        for (int i = 0; i < gridHistory[currentPointOfTime + 1].Count; i++)
        {
            GridChange change = gridHistory[currentPointOfTime + 1][i];
            BoardOS.ForceChange(change.gridPos, change.changedElementID, true, false);//
        }
        currentPointOfTime++;
        gridPresent.Clear();

        bRedo.interactable = (currentPointOfTime < gridHistory.Count - 1);
        bUndo.interactable = true;
    }