public virtual void ApplyInput(PlayerInputPacket command, float delta) { Vector2 velocity = Vector2.zero; if ((command.Keys & MovementKeys.Up) != 0) { velocity.y = -1f; } if ((command.Keys & MovementKeys.Down) != 0) { velocity.y = 1f; } if ((command.Keys & MovementKeys.Left) != 0) { velocity.x = -1f; } if ((command.Keys & MovementKeys.Right) != 0) { velocity.x = 1f; } _position += velocity.normalized * _speed * delta; _rotation = command.Rotation; if ((command.Keys & MovementKeys.Fire) != 0) { if (_attackTimer.IsTimeElapsed) { _attackTimer.Reset(); Attack(); } } }
public virtual void ApplyInput(PlayerInputPacket command, float delta) { Vector2 velocity = Vector2.zero; if ((command.Keys & MovementKeys.Up) != 0) { velocity.y = -1f; } if ((command.Keys & MovementKeys.Down) != 0) { velocity.y = 1f; } _position += velocity.normalized * _speed * delta; }