private void Update() { // This can all be moved into some MouseMoved function later on if (tileManager.CurrentTile == gameObject) { ShaderLocalTime += Time.deltaTime * 3; Shader.SetGlobalFloat("LocalTime", ShaderLocalTime); if (Vector3.Distance(startMousePos, cameraManager.worldSpaceMousePos) > (_tileSize * TILE_DIST_CHECK) && !tweening) { if (_isFixed) { tileManager.CantMoveTile(); return; } var dir = (cameraManager.worldSpaceMousePos - startMousePos).normalized; //newPos += (dir.normalized); if (CheckDot(dir)) { if (CheckAdjacent(dir)) { transform.DOMove((transform.position + (dir * _tileSize)).RoundToNearest(_tileSize), TILE_MOVE_SPEED) .OnStart(() => { tweening = true; tileManager.TileMoving(); }) .OnComplete(() => { startMousePos = cameraManager.worldSpaceMousePos; tweening = false; tileManager.NewTilePosition(); }); } } } } }