void Update() { if (!(shiftBlock && datamanager.shiftingFunctionFinished)) { equationText.transform.position = transform.position; } if (shiftBlock && datamanager.shiftingFunctionFinished) { transform.position = Vector3.MoveTowards(transform.position, whereToShift, shiftSpeed * Time.deltaTime); equationText.transform.position = Vector3.MoveTowards(transform.position, whereToShift, shiftSpeed * Time.deltaTime); if (whereToShift.y == transform.position.y) { transform.position = whereToShift; //equationText.transform.position = whereToShift; shiftBlock = false; datamanager.blocksMoved++; StoreBlcokData(transform.position.x, transform.position.y); if (datamanager.blocksMoved == datamanager.blocksToMove) { datamanager.CreateNewBlock(); datamanager.blocksMoved = 0; } } } if (!active && !shiftBlock) { if (color.a != 1.0) { color.a = 1.0f; } return; } if (currentTimeOfLowerPortionOfBlockHit != DateTime.MinValue && TimeInSecondsPast(currentTimeOfLowerPortionOfBlockHit, 2) && (lowerWallHit || IgnoreFirstTrue > 1) && !shiftBlock) { var newyPos = 0f; try { newyPos = datamanager.SnapToBottom(bottomOfMap, transform.position.x, transform.position.y, spriteRender.bounds.min.y); } catch { sceneLoader.LoadNextScene(); return; } transform.position = new Vector3(transform.position.x, newyPos, blockZValue); StoreBlcokData(transform.position.x, transform.position.y); active = false; if (datamanager.CheckForMatches(transform.position.y, transform.position.x)) { } else { datamanager.InplaceSound(); datamanager.CreateNewBlock(); color.a = 1.0f; spriteRender.color = color; } } else if (isActive()) { if (!lowerWallHit && !BottomBlockHit()) { Gravity(); } else if (lowerWallHit || BottomBlockHit() && !shiftBlock) { ActiveBlink(); } PlayerKeyListner(); if (BottomBlockHit()) { if (!timeTriggered && IgnoreFirstTrue > 1) { currentTimeOfLowerPortionOfBlockHit = DateTime.Now; timeTriggered = true; } } } }