Advertisement
OwlyOwl

123esadawre2

Feb 15th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. public class PlayerMovementSystem : GameSystem, IUpdating
  2. {
  3.     [SerializeField] [ReadOnly] int currentLine; // -1 = left, 0 = center, 1 = right
  4.  
  5.     void IUpdating.OnUpdate()
  6.     {
  7.         if (game.swipeDirection != 0)
  8.         {
  9.             if (currentLine != game.swipeDirection)
  10.             {
  11.                 currentLine += game.swipeDirection;
  12.                
  13.                 //add smooth movement
  14.  
  15.                 var position = game.player.position;
  16.                 position.x = game.linesPositions[currentLine];
  17.                 game.player.position = position;
  18.             }
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement