Cafu Engine
CompTarget.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_GAMESYS_COMPONENT_TARGET_HPP_INCLUDED
8 #define CAFU_GAMESYS_COMPONENT_TARGET_HPP_INCLUDED
9 
10 #include "CompBase.hpp"
11 
12 
13 namespace cf
14 {
15  namespace GameSys
16  {
17  /// This component connects its entity to another.
18  /// It is used by Script or GUI (Model) components in order to learn which other entity
19  /// is related and should possibly be acted upon. For example, Target components are
20  /// often used to let generic "open door" GUIs know which door they should actually open.
22  {
23  public:
24 
25  /// The constructor.
27 
28  /// The copy constructor.
29  /// @param Comp The component to create a copy of.
31 
32  // /// Returns ...
33  // xy GetTargetEntity() const;
34 
35 
36  // Base class overrides.
37  ComponentTargetT* Clone() const;
38  const char* GetName() const { return "Target"; }
39  unsigned int GetEditorColor() const { return 0x0000FF; }
40  BoundingBox3fT GetEditorBB() const { return BoundingBox3fT(Vector3fT(-8, -8, -8), Vector3fT(8, 8, 8)); }
41 
42 
43  // The TypeSys related declarations for this class.
44  const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
45  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
46  static const cf::TypeSys::TypeInfoT TypeInfo;
47 
48 
49  protected:
50 
51  // The Lua API methods of this class.
52  static int toString(lua_State* LuaState);
53 
54  static const luaL_Reg MethodsList[]; ///< The list of Lua methods for this class.
55  static const char* DocClass;
56  static const cf::TypeSys::MethsDocT DocMethods[];
57  static const cf::TypeSys::VarsDocT DocVars[];
58 
59 
60  private:
61 
62  TypeSys::VarT<std::string> m_TargetName;
63  };
64  }
65 }
66 
67 #endif
BoundingBox3fT GetEditorBB() const
Returns a bounding-box that the Map Editor can use to render the representation of this component's e...
Definition: CompTarget.hpp:40
unsigned int GetEditorColor() const
Returns a color that the Map Editor can use to render the representation of this component's entity...
Definition: CompTarget.hpp:39
ComponentTargetT()
The constructor.
Definition: CompTarget.cpp:40
This component connects its entity to another.
Definition: CompTarget.hpp:21
ComponentTargetT * Clone() const
The virtual copy constructor.
Definition: CompTarget.cpp:56
static const luaL_Reg MethodsList[]
The list of Lua methods for this class.
Definition: CompTarget.hpp:54
const char * GetName() const
Returns the name of this component.
Definition: CompTarget.hpp:38
Definition: TypeSys.hpp:52
Definition: TypeSys.hpp:57
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79
Definition: TypeSys.hpp:68
This is the base class for the components that an entity is composed/aggregated of.
Definition: CompBase.hpp:54