Component.pkg 932 B

123456789101112131415161718192021222324
  1. $#include "Component.h"
  2. /// Base class for components. Components can be created to scene nodes.
  3. class Component : public Serializable
  4. {
  5. public:
  6. /// Set enabled/disabled state.
  7. void SetEnabled(bool enable);
  8. /// Remove from the scene node. If no other shared pointer references exist, causes immediate deletion.
  9. void Remove();
  10. /// Return ID.
  11. unsigned GetID() const { return id_; }
  12. /// Return scene node.
  13. Node* GetNode() const { return node_; }
  14. /// Return the scene the node belongs to.
  15. Scene* GetScene() const;
  16. /// Return whether is enabled.
  17. bool IsEnabled() const { return enabled_; }
  18. /// Return whether is effectively enabled (node is also enabled.)
  19. bool IsEnabledEffective() const;
  20. /// Return component in the same scene node by type. If there are several, returns the first.
  21. Component* GetComponent(ShortStringHash type) const;
  22. };