Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - copyleft

Pages: [1]
1
This would be a helpful function for me.

2
Support / [Grids 2D] Looking for function to set cell as highlighted
« on: January 10, 2021, 01:16:51 AM »
https://streamable.com/dgw04t

I'm working on moving this cursor and highlight across my Grids2D cells.

I am working if there's a way to use the same highlight effect, but on keyboard WASD/arrow movement. Something where I can set a cellIndex as highlighted, and clear the rest.

3
Support / Having trouble with speed of cell selection
« on: October 19, 2020, 02:32:51 AM »
Adding the keyboard input code:

 IEnumerator UserCellSelection(int lastCellIndex) {
     int cellIndex;
     float waitTime = 20000000f;
     float vertAxis = Input.GetAxis("Vertical");
     float horiAxis = Input.GetAxis("Horizontal");
             
     if (vertAxis != 0) {
         if (!movingPlayer)
             tgs.ClearAll();
         int newRow;
         
         if (vertAxis > 0) {
             newRow = SelectedCell.row + 1;
         } else {
             newRow = SelectedCell.row - 1;
         }
         if (newRow < 0)
             newRow = 0;
         cellIndex = tgs.CellGetIndex(newRow, SelectedCell.column);
         
         
     if (horiAxis != 0) {
         if (!movingPlayer)
             tgs.ClearAll();
         int newCol;
         
         if (horiAxis > 0) {
             newCol = SelectedCell.column + 1;
         } else {
             newCol = SelectedCell.column - 1;
         }
         if (newCol < 0) {
             newCol = 0;
         }
         cellIndex = tgs.CellGetIndex(SelectedCell.row, newCol);
         
         lastCellIndex = SelectedCell.index;
     }
 }
I call this method:

 new void Update()
 {
     base.Update();
     // Only check for user input during Player Phase
     if (gameManager.currentPhase == "Player") {
         int lastCellIndex = SelectedCell.index;
         StartCoroutine("UserCellSelection", lastCellIndex);
         if(actionSelect)  // Draw attack range
             DrawPlayerAttackRange();
         if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.X)) {
             UndoPlayerSelect();
             UndoPlayerMove();
         }
I tried using WaitForSecondsRealtime, no dice. I wrote this on an older laptop, so the slow FPS was making selection more manageable. I don't want to intentionally limit my FPS, looking for a solution to move one square every 10 seconds, somewhere around there.

I am using Terrain Grid System plugin for the grid. I've basically tied to Horizontal & Vertical Axes to rows and columns in the grid.


Pages: [1]