Nebula
Loading...
Searching...
No Matches
featureunit.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
20#include "core/refcounted.h"
21#include "game/manager.h"
22#include "core/singleton.h"
24#include "io/jsonwriter.h"
26#include "util/arrayallocator.h"
27
28//------------------------------------------------------------------------------
29namespace Game
30{
31
33{
35public:
39 virtual ~FeatureUnit();
40
42 virtual void OnAttach();
44 virtual void OnRemove();
45
47 virtual void OnActivate();
49 virtual void OnDeactivate();
50
52 bool IsActive() const;
53
55 virtual void OnLoad(World* world);
57 virtual void OnStart(World* world);
59 virtual void OnSave(World* world);
60
62 virtual void OnBeforeLoad(World* world);
64 virtual void OnBeforeCleanup(World* world);
66 virtual void OnStop(World* world);
67
68
70 virtual void OnBeginFrame();
72 virtual void OnBeforeViews();
74 virtual void OnFrame();
76 virtual void OnEndFrame();
78 virtual void OnDecay();
79
81 virtual void OnRenderDebug();
82
84 virtual void AttachManager(Ptr<Manager> manager);
86 virtual void RemoveManager(Ptr<Manager> manager);
87
92
93protected:
95 bool active;
96
99};
100
101//------------------------------------------------------------------------------
104inline bool
106{
107 return this->active;
108}
109
110//------------------------------------------------------------------------------
113inline void
115{
116 this->args = a;
117}
118
119//------------------------------------------------------------------------------
122inline const Util::CommandLineArgs&
124{
125 return this->args;
126}
127
128} // namespace FeatureUnit
129//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
A FeatureUnit is an encapsulated feature which can be added to an application.
Definition featureunit.h:33
virtual void OnStart(World *world)
called from within GameServer::OnStart() after OnLoad
Definition featureunit.cc:105
virtual void OnStop(World *world)
called from withing GameServer::Stop()
Definition featureunit.cc:294
Util::CommandLineArgs args
cmdline args for configuration from cmdline
Definition featureunit.h:98
virtual void OnAttach()
called from GameServer::AttachGameFeature()
Definition featureunit.cc:36
virtual void OnLoad(World *world)
called from within GameServer::Load()
Definition featureunit.cc:87
virtual void OnFrame()
called in the middle of the feature trigger cycle
Definition featureunit.cc:175
virtual void OnBeforeLoad(World *world)
called from within GameServer::NotifyBeforeLoad()
Definition featureunit.cc:273
virtual void OnBeforeCleanup(World *world)
called from within GameServer::NotifyBeforeCleanup()
Definition featureunit.cc:282
Util::Array< Ptr< Manager > > managers
Definition featureunit.h:94
virtual void OnDecay()
called after entities has been destroyed and before releasing their memory
Definition featureunit.cc:208
bool IsActive() const
return true if featureunit is currently active
Definition featureunit.h:105
void SetCmdLineArgs(const Util::CommandLineArgs &a)
set command line args
Definition featureunit.h:114
bool active
Definition featureunit.h:95
virtual void OnActivate()
called after GameServer::AttachGameFeature()
Definition featureunit.cc:56
virtual __DeclareClass(FeatureUnit) public ~FeatureUnit()
destructor
Definition featureunit.cc:27
virtual void OnSave(World *world)
called from within GameServer::Save()
Definition featureunit.cc:121
virtual void OnRenderDebug()
called when game debug visualization is on
Definition featureunit.cc:225
virtual void OnEndFrame()
called at the end of the feature trigger cycle
Definition featureunit.cc:193
virtual void OnRemove()
called from GameServer::RemoveGameFeature()
Definition featureunit.cc:45
virtual void RemoveManager(Ptr< Manager > manager)
remove a manager from the feature unit
Definition featureunit.cc:255
virtual void OnBeginFrame()
called on begin of frame
Definition featureunit.cc:138
virtual void OnDeactivate()
called before GameServer::RemoveGameFeature()
Definition featureunit.cc:68
virtual void AttachManager(Ptr< Manager > manager)
attach a manager to the feature unit
Definition featureunit.cc:243
const Util::CommandLineArgs & GetCmdLineArgs() const
get command line args
Definition featureunit.h:123
virtual void OnBeforeViews()
Called between beginning of frame and before the views are iterated.
Definition featureunit.cc:156
Definition world.h:50
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
A universal cmd line argument parser.
Definition commandlineargs.h:24
Game::EditorState.
Definition orientation.h:7
#define __DeclareClass(type)