|
@@ -39,6 +39,8 @@ World::~World()
|
|
zScreenPtr->removeKamera( kam );
|
|
zScreenPtr->removeKamera( kam );
|
|
dimensions->release();
|
|
dimensions->release();
|
|
currentPlayer->release();
|
|
currentPlayer->release();
|
|
|
|
+ if( currentTarget )
|
|
|
|
+ currentTarget->release();
|
|
}
|
|
}
|
|
|
|
|
|
void World::update( bool background )
|
|
void World::update( bool background )
|
|
@@ -124,6 +126,14 @@ Block* World::zBlockAt( Framework::Vec3<int> location, int dimension ) const
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Block* World::getBlockAt( Framework::Vec3<int> location, int dimension ) const
|
|
|
|
+{
|
|
|
|
+ Dimension* dim = zDimension( dimension );
|
|
|
|
+ if( dim )
|
|
|
|
+ return dim->getBlock( location );
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
Dimension* World::zDimension( int id ) const
|
|
Dimension* World::zDimension( int id ) const
|
|
{
|
|
{
|
|
for( auto dim : *dimensions )
|
|
for( auto dim : *dimensions )
|
|
@@ -188,6 +198,17 @@ Entity* World::zEntity( int id ) const
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Entity* World::getEntity( int id ) const
|
|
|
|
+{
|
|
|
|
+ for( Dimension* d : *dimensions )
|
|
|
|
+ {
|
|
|
|
+ Entity* e = d->getEntity( id );
|
|
|
|
+ if( e )
|
|
|
|
+ return e;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
void World::removeEntity( int id )
|
|
void World::removeEntity( int id )
|
|
{
|
|
{
|
|
for( Dimension* d : *dimensions )
|
|
for( Dimension* d : *dimensions )
|
|
@@ -220,9 +241,16 @@ void World::setTarget( Framework::Model3D* zTarget )
|
|
if( zTarget != currentTarget )
|
|
if( zTarget != currentTarget )
|
|
{
|
|
{
|
|
if( currentTarget )
|
|
if( currentTarget )
|
|
|
|
+ {
|
|
currentTarget->setAmbientFactor( currentTarget->getAmbientFactor() - 0.2f );
|
|
currentTarget->setAmbientFactor( currentTarget->getAmbientFactor() - 0.2f );
|
|
- currentTarget = zTarget;
|
|
|
|
- if( currentTarget )
|
|
|
|
- currentTarget->setAmbientFactor( currentTarget->getAmbientFactor() + 0.2f );
|
|
|
|
|
|
+ currentTarget->release();
|
|
|
|
+ currentTarget = 0;
|
|
|
|
+ }
|
|
|
|
+ if( zTarget )
|
|
|
|
+ {
|
|
|
|
+ currentTarget = dynamic_cast<Framework::Model3D*>(zTarget->getThis());
|
|
|
|
+ if( currentTarget )
|
|
|
|
+ currentTarget->setAmbientFactor( currentTarget->getAmbientFactor() + 0.2f );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|