Esempio n. 1
0
 /**
  * Sets the data
  *
  * @param buffer Bytebuffer to put data into
  */
 public void get(ByteBuffer buffer) {
   buffer.putInt((int) world.x);
   buffer.putInt((int) world.y);
   buffer.putDouble(radians);
   buffer.put((byte) (moving ? 1 : 0));
   for (Bullet b : gun.getBullets()) {
     if (b != null) {
       buffer.putInt((int) b.getWorld().x);
       buffer.putInt((int) b.getWorld().y);
       buffer.putDouble(b.getAngle());
     } else {
       buffer.putInt(-1);
       buffer.putInt(-1);
       buffer.putDouble(-1);
     }
   }
 }
Esempio n. 2
0
 /**
  * Sets the data
  *
  * @param buffer Bytebuffer holding the data
  */
 public void set(ByteBuffer buffer) {
   health = buffer.getInt();
 }