protected bool CanIMove(int nextPosX, int nextPosY) { if (grid.StayInGrid(nextPosX, nextPosY)) { Transform nextCellObject = grid.grid[nextPosX, nextPosY].whoAmI(); if (nextCellObject != null) { if (nextCellObject.CompareTag("Object")) { return(false); } else if (nextCellObject.CompareTag("Target")) { return(true); } else { return(true); } } else { return(true); } } else { return(false); } }
private bool CanIMove(int nextPosX, int nextPosY) { if (grid.StayInGrid(nextPosX, nextPosY)) { Transform nextCellObject = grid.grid[nextPosX, nextPosY].whoAmI(); if (nextCellObject != null) { return(nextCellObject.GetComponent <AG_Objects>().Interact(xIncrease, yIncrease)); } else { return(true); } } else { return(false); } }