ItemEntity.cpp 745 B

123456789101112131415161718192021222324252627282930313233
  1. #include "ItemEntity.h"
  2. #include "ItemSlot.h"
  3. #include "Globals.h"
  4. ItemEntity::ItemEntity()
  5. : Entity( ItemEntityType::INSTANCE, 1 )
  6. {
  7. slot = new ItemSlot( INT_MAX, 0, 0, 0, ANY_DIRECTION, 0 );
  8. addSlot( slot );
  9. currentGame->setVisibility( this, 1 );
  10. // TODO: initialize model3d
  11. }
  12. bool ItemEntity::tick( double time )
  13. {
  14. if( !model && slot->zStack() )
  15. {
  16. setModelDaten( slot->zStack()->zItem()->zItemType()->getItemModel() );
  17. textur = slot->zStack()->zItem()->zItemType()->getItemTextur();
  18. }
  19. return Entity::tick( time );
  20. }
  21. ItemEntityType::ItemEntityType()
  22. : EntityType( ID )
  23. {}
  24. Entity* ItemEntityType::createEntity() const
  25. {
  26. return new ItemEntity();
  27. }