private static void initializeFloor() /* Create the grid of floor squares. */ { // Create the grid. foreach (int xIdx in Enumerable.Range(0, numGridSquaresWide)) { foreach (int yIdx in Enumerable.Range(0, numGridSquaresDeep)) { Vector2 gridIndices = new Vector2(xIdx, yIdx); bool isSacred = yIdx == 0; PrefabInstantiator.P.CreateFloorSquare(gridIndices, isSacred: isSacred); } } // Stain all but the starting unstained rows, 1 extra turn of stain per row you move back. foreach (int xIdx in Enumerable.Range(0, numGridSquaresWide)) { foreach (int yIdx in Enumerable.Range(0, numGridSquaresDeep - startingUnstainedRows)) { Vector2 gridIndices = new Vector2(xIdx, yIdx); FloorSquare floorSquare = floorSquaresMap[gridIndices]; int stainTurns = numGridSquaresDeep - startingUnstainedRows - yIdx; floorSquare.addStainTurns(stainTurns); } } }
public override void cardAction() /* See cardAction on base class Card. */ { Vector2 gridIndices = (Vector2)TrialLogic.mouseDownGridIndices; FloorSquare floorSquare = TrialLogic.floorSquaresMap[gridIndices]; floorSquare.addStainTurns(-floorSquare.numTurnsStained); }
public void destroy() /* Remove this Block from the grid, applying any onDestroy effects. */ { // If this Block has any onDestroy effects, run them. if (blockType == BlockType.RED) { destroyNeighboringMass(); } FloorSquare floorSquare = TrialLogic.floorSquaresMap[gridIndices]; floorSquare.addStainTurns(1); TrialLogic.placedBlocks.Remove(gridIndices); EventLog.LogEvent($"Was destroyed at {gridIndices}."); Destroy(gameObject); }