Esempio n. 1
0
  public Player(Controls input, World w) {
    this.input = input;
    this.w = w;

    classtype = Class.Warrior;
    racetype = Race.Human;
    rightweapon = Weapon.load(classtype.getRightHandWeapon());
    leftweapon = Weapon.load(classtype.getLeftHandWeapon());

    ghostObject = new btPairCachingGhostObject();
    ghostObject.setWorldTransform(new Matrix4());
    w.physicsWorld.getPairCache().setInternalGhostPairCallback(new btGhostPairCallback());
    ghostObject.setCollisionShape(P.PLAYER_SHAPE);
    ghostObject.setCollisionFlags(
        CollisionFlags.CF_CHARACTER_OBJECT | CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
    characterController = new btKinematicCharacterController(ghostObject, P.PLAYER_SHAPE, 0.3f);
    ghostObject.setContactCallbackFilter(World.ALL_FLAG ^ World.FLOOR_FLAG);
    w.physicsWorld.addCollisionObject(ghostObject, World.CHARACTER_FLAG, World.ALL_FLAG);
    w.physicsWorld.addAction(characterController);

    //     actionZone = new btCollisionObject();
    //     actionZone.setCollisionShape(new btBoxShape(0,5f, 0,5f, 1f));
    characterController.setUpAxis(3);
    characterController.setMaxSlope(MathUtils.PI / 3);

    updateBaseStats();
    System.out.println("got through player constructor");
    //		w.physicsWorld.addCollisionObject(actionZone);

    face = new Vector3(0, 1, 0);
  }
Esempio n. 2
0
 public void iterateClass(int i) {
   int newClassID = classtype.getID() + i;
   newClassID = (newClassID + P.Class.LENGTH) % P.Class.LENGTH;
   classtype = P.Class.getFromID(newClassID);
   rightweapon.dispose();
   rightweapon = Weapon.load(classtype.getRightHandWeapon());
   leftweapon.dispose();
   leftweapon = Weapon.load(classtype.getLeftHandWeapon());
   loadWeaponModels();
   updateBaseStats();
 }