Interface used to implement a game object extension
struct IGameObjectExtension : public IComponent { };
IGameObject.h
virtual ~IGameObjectExtension();
Performs the serialization the extension
virtual void FullSerialize(TSerialize ser) = 0;
Parameters |
Description |
TSerialize ser |
object used to serialize values |
aspect |
serialization aspect, used for network serialization |
profile |
which profile to serialize; 255 == don't care |
flags |
physics flags to be used for serialization |
ISerialize
Retrieves the pointer to the entity
IEntity * GetEntity() const;
A pointer to the entity which hold this game object extension
Retrieves the EntityId
EntityId GetEntityId() const;
An EntityId to the entity which hold this game object extension
Builds a signature to describe the dynamic hierarchy of the parent Entity container
virtual bool GetEntityPoolSignature(TSerialize signature) = 0;
Parameters |
Description |
TSerialize signature |
the object to serialize with, forming the signature |
true - If the signature is thus far valid
It's the responsibility of the proxy to identify its internal state which may complicate the hierarchy of the parent Entity i.e., sub-proxies and which actually exist for this instantiation.
virtual ComponentEventPriority GetEventPriority(const int eventID) const;
IComponent
Retrieves the pointer to the game object
IGameObject * GetGameObject() const;
A pointer to the game object which hold this extension
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
Return the aspects NetSerialize serializes. Overriding this to return only the aspects used will speed up the net bind of the object.
virtual NetworkAspectType GetNetSerializeAspects();
Retrieves the RMI Base pointer
virtual const void * GetRMIBase() const = 0;
Internal function used for RMI. It's usually implemented by CGameObjectExtensionHelper provides a way of checking who should receive some RMI call.
virtual ISerializableInfoPtr GetSpawnInfo() = 0;
Processes game specific events
virtual void HandleEvent(const SGameObjectEvent& event) = 0;
Parameters |
Description |
const SGameObjectEvent& event |
game event |
IGameObjectExtension();
Initialize the extension
virtual bool Init(IGameObject * pGameObject) = 0;
Parameters |
Description |
IGameObject * pGameObject |
a pointer to the game object which will use the extension |
IMPORTANT: It's very important that the implementation of this function call the protected function SetGameObject() during the execution of the Init() function. Unexpected results would happen otherwise.
Initialize the extension (client only)
virtual void InitClient(int channelId) = 0;
Parameters |
Description |
int channelId |
id of the server channel of the client to receive the initialization |
This initialization function should be use to initialize resource only used in the client
virtual bool NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags) = 0;
Post-initialize the extension
virtual void PostInit(IGameObject * pGameObject) = 0;
Parameters |
Description |
IGameObject * pGameObject |
a pointer to the game object which owns the extension |
During the post-initialization, the extension is now contained in the game object
Post-initialize the extension (client only)
virtual void PostInitClient(int channelId) = 0;
Parameters |
Description |
int channelId |
id of the server channel of the client to receive the initialization |
This initialization function should be use to initialize resource only used in the client. During the post-initialization, the extension is now contained in the game object
Post-reload the extension
virtual void PostReloadExtension(IGameObject * pGameObject, const SEntitySpawnParams & params) = 0;
Parameters |
Description |
IGameObject * pGameObject |
a pointer to the game object which owns the extension |
Called when owning entity is reloaded and all its extensions have either either been reloaded or destroyed
virtual void PostRemoteSpawn() = 0;
Summary
Performs post serialization fixes
virtual void PostSerialize() = 0;
Performs an additional update
virtual void PostUpdate(float frameTime) = 0;
Parameters |
Description |
float frameTime |
time elapsed since the last frame update |
Processes entity specific events
virtual void ProcessEvent(SEntityEvent& event) = 0;
Parameters |
Description |
SEntityEvent& event |
entity event, see SEntityEvent for more information |
Releases the resources used by the object
virtual void Release() = 0;
This function should also take care of freeing the instance once the resource are freed.
Reload the extension
virtual bool ReloadExtension(IGameObject * pGameObject, const SEntitySpawnParams & params) = 0;
Parameters |
Description |
IGameObject * pGameObject |
a pointer to the game object which owns the extension |
TRUE if the extension should be kept, FALSE if it should be removed
Called when owning entity is reloaded
IMPORTANT: It's very important that the implementation of this function call the protected function ResetGameObject() during the execution of the ReloadExtension() function. Unexpected results would happen otherwise.
void ResetGameObject();
Performs the serialization of special spawn information
virtual void SerializeSpawnInfo(TSerialize ser) = 0;
Parameters |
Description |
TSerialize ser |
object used to serialize values |
Serialize, ISerialize
virtual void SetAuthority(bool auth) = 0;
virtual void SetChannelId(uint16 id) = 0;
void SetGameObject(IGameObject * pGameObject);
Performs frame dependent extension updates
virtual void Update(SEntityUpdateContext& ctx, int updateSlot) = 0;
Parameters |
Description |
SEntityUpdateContext& ctx |
Update context |
int updateSlot |
updateSlot |