DEADSOFTWARE

Update version
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GamePhysics.java
index 9edffe4a9f3c41e128b1cfb30ee5e2561a6db5f1..a2354f0c8f9ea68edd6d9b6242c1bda9f18a245f 100644 (file)
@@ -7,7 +7,7 @@ import com.badlogic.gdx.math.Vector2;
 import ru.deadsoftware.cavedroid.MainConfig;
 import ru.deadsoftware.cavedroid.game.mobs.Mob;
 import ru.deadsoftware.cavedroid.game.mobs.MobsController;
-import ru.deadsoftware.cavedroid.game.mobs.Player;
+import ru.deadsoftware.cavedroid.game.mobs.player.Player;
 import ru.deadsoftware.cavedroid.game.model.block.Block;
 import ru.deadsoftware.cavedroid.game.objects.Drop;
 import ru.deadsoftware.cavedroid.game.objects.DropController;
@@ -113,6 +113,10 @@ public class GamePhysics {
     private Rectangle getShiftedMagnetingPlayerRect(Drop drop) {
         final Player player = mMobsController.getPlayer();
 
+        if (!player.inventory.canPickItem(drop.getItem())) {
+            return null;
+        }
+
         if (drop.canMagnetTo(player)) {
             return getShiftedPlayerRect(0);
         }
@@ -134,7 +138,7 @@ public class GamePhysics {
         final Player player = mMobsController.getPlayer();
 
         if (Intersector.overlaps(shiftedPlayerTarget, drop)) {
-            player.pickUpDrop(drop);
+            player.inventory.pickDrop(drop);
         }
     }
 
@@ -335,6 +339,7 @@ public class GamePhysics {
         }
 
         playerPhy(player, delta);
+        player.ai(mGameWorld, mGameItemsHolder, delta);
         if (player.isDead()) {
             player.respawn(mGameWorld, mGameItemsHolder);
         }