private void Update() { MoveView(); if (cTile != GetTile()) { SetTileColor(cTile, deselectedCell, 0); cTile = GetTile(); SetTileColor(cTile, selectedCell, 2); } if (!isMoving && Input.GetMouseButtonDown(0)) { if (CheckForTile(cTile)) { CalcMoveVars(); } } if (isMoving) { float coveredDist = (Time.time - startTime) * movementSpeed; float fractionOfDist = coveredDist / distance; transform.position = Vector3.Lerp(currentPos, nextPos, fractionOfDist); if (transform.position == nextPos) { isMoving = false; currentPos = nextPos; dGrid.DrawCells(); } } }
//TODO: only check me after teleporting void Update() { if (lastPosition != playerTransform.position) { drawGrid.DrawCells(); } }