Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PlayerMovementSystem : GameSystem, IUpdating
- {
- [SerializeField] [ReadOnly] int currentLine; // -1 = left, 0 = center, 1 = right
- void IUpdating.OnUpdate()
- {
- if (game.swipeDirection != 0)
- {
- if (currentLine != game.swipeDirection)
- {
- currentLine += game.swipeDirection;
- //add smooth movement
- var position = game.player.position;
- position.x = game.linesPositions[currentLine];
- game.player.position = position;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement