protected virtual void Move() { if (moving) { moveTicker += Time.deltaTime / MOVE_SPEED; if (moveTicker >= 1) { moveTicker = 1; currentTile.Enter(this); moving = false; FinishedMoving(); } } if (previousTile != null) { positionSetter.transform.position = Vector3.Lerp(previousTile.transform.position, currentTile.transform.position, Interpolation.Pow2Out(0, 1, moveTicker)); } }
public virtual void MoveToTile(S_Tile tile, bool instant) { if (tile == null || tile==currentTile) return; previousTile = currentTile; SetTile(tile); if (previousTile != null){ currentDX = currentTile.x - previousTile.x; currentDY = currentTile.y - previousTile.y; } if (instant) { moveTicker = 1; positionSetter.transform.localPosition = currentTile.transform.localPosition; tile.Enter(this); } else { StartMoving(); } }
public virtual void MoveToTile(S_Tile tile, bool instant) { if (tile == null || tile == currentTile) { return; } previousTile = currentTile; SetTile(tile); if (previousTile != null) { currentDX = currentTile.x - previousTile.x; currentDY = currentTile.y - previousTile.y; } if (instant) { moveTicker = 1; positionSetter.transform.localPosition = currentTile.transform.localPosition; tile.Enter(this); } else { StartMoving(); } }