Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6485


Ignore:
Timestamp:
Mar 7, 2010, 11:16:03 PM (15 years ago)
Author:
dafrick
Message:

Added changedActivity and changedVisibility method to WorldEntity, such that, when either is changed it is changed for all attached objects as well.
If this is already implemented somehow and somehwere, my mistake, but I looked and found nothing.

Location:
code/branches/pickup3/src/orxonox/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/orxonox/worldentities/WorldEntity.cc

    r6417 r6485  
    201201        registerVariable(this->parentID_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
    202202    }
     203   
     204    /**
     205    @brief
     206        When the activity is changed, it is changed for all attached objects as well.
     207    */
     208    void WorldEntity::changedActivity(void)
     209    {
     210        SUPER(WorldEntity, changedActivity);
     211       
     212        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     213        {
     214            (*it)->setActive(this->isActive());
     215        }
     216    }
     217   
     218    /**
     219    @brief
     220        When the visibility is changed, it is changed for all attached objects as well.
     221    */
     222    void WorldEntity::changedVisibility(void)
     223    {
     224        SUPER(WorldEntity, changedVisibility);
     225       
     226        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     227        {
     228            (*it)->setVisible(this->isVisible());
     229        }
     230    }
    203231
    204232    /**
  • code/branches/pickup3/src/orxonox/worldentities/WorldEntity.h

    r6417 r6485  
    106106            static const Vector3 DOWN;
    107107            static const Vector3 UP;
     108           
     109            virtual void changedActivity(void);
     110            virtual void changedVisibility(void);
    108111
    109112            virtual void setPosition(const Vector3& position) = 0;
Note: See TracChangeset for help on using the changeset viewer.