Vehicle System interface
struct IVehicleSystem { };
IVehicleSystem.h
Interface used to implement the vehicle system.
virtual ~IVehicleSystem();
Registers a newly spawned vehicle in the vehicle system
virtual TVehicleObjectId AssignVehicleObjectId() = 0;
virtual TVehicleObjectId AssignVehicleObjectId(const string& className) = 0;
Announces OnUse events for vehicles.
virtual void BroadcastVehicleUsageEvent(const EVehicleEvent eventId, const EntityId playerId, IVehicle* pVehicle) = 0;
Parameters |
Description |
const EntityId playerId |
the entity id of the player that the listener is registered for. |
IVehicle* pVehicle |
the vehicle which the player is interacting. |
eventID |
One of the events declared in EVehicleEvent, currently only eVE_PassengerEnter and eVE_PassengerExit |
RegisterVehicleUsageEventListener UnregisterVehicleEventListener
Spawns a new vehicle instance
Parameters |
Description |
uint16 channelId |
Id of the intented channel |
const char * name |
Name of the new vehicle instance to be spawned |
const char * vehicleClass |
Name of the vehicle class requested |
const Vec3 & pos |
Position of the new vehicle instance |
const Quat & rot |
Rotation of the new vehicle instance |
const Vec3 & scale |
Scale factor of the new vehicle instance |
EntityId id = 0 |
Unused |
A pointer to the correct vehicle proxy. The value 0 is returned in case that the specified vehicle couldn't be created.
Will spawn an entity based on the vehicle class requested. Usually called by the entity system when a vehicle entity is spawned.
virtual IVehicleAction* CreateVehicleAction(const string& name) = 0;
virtual IVehicleDamageBehavior* CreateVehicleDamageBehavior(const string& name) = 0;
virtual IVehicleIteratorPtr CreateVehicleIterator() = 0;
virtual IVehicleMovement* CreateVehicleMovement(const string& name) = 0;
virtual IVehiclePart* CreateVehiclePart(const string& name) = 0;
virtual IVehicleSeatAction* CreateVehicleSeatAction(const string& name) = 0;
virtual IVehicleView* CreateVehicleView(const string& name) = 0;
DECLARE_GAMEOBJECT_FACTORY(IVehicleAction);
DECLARE_GAMEOBJECT_FACTORY(IVehicleDamageBehavior);
DECLARE_GAMEOBJECT_FACTORY(IVehicleMovement);
DECLARE_GAMEOBJECT_FACTORY(IVehiclePart);
DECLARE_GAMEOBJECT_FACTORY(IVehicleSeatAction);
DECLARE_GAMEOBJECT_FACTORY(IVehicleView);
virtual IVehicleDamagesTemplateRegistry* GetDamagesTemplateRegistry() = 0;
virtual bool GetOptionalScript(const char* vehicleName, char* buf, size_t len) = 0;
Gets the Vehicle proxy of an entity
A pointer to the correct vehicle proxy. The value 0 is returned in case that the proxy wasn't found.
Will return the correct vehicle proxy of a vehicle entity.
virtual IVehicle* GetVehicleByChannelId(uint16 channelId) = 0;
Returns the vehicle client class implementation
virtual IVehicleClient* GetVehicleClient() = 0;
A pointer to the current vehicle client implementation, or null if none as been registrated
Used to get the count of all vehicle instance
virtual uint32 GetVehicleCount() = 0;
The count of all the vehicle instance created by the vehicle system
virtual void GetVehicleImplementations(SVehicleImpls& impls) = 0;
virtual TVehicleObjectId GetVehicleObjectId(const string& className) const = 0;
virtual bool Init() = 0;
virtual bool IsVehicleClass(const char * name) const = 0;
Performs the registration of vehicle client implementation
virtual void RegisterVehicleClient(IVehicleClient* pVehicleClient) = 0;
Parameters |
Description |
IVehicleClient* pVehicleClient |
a pointer to the vehicle client implementation Notes Only one vehicle client implementation can be registrated |
Performs the registration of all the different vehicle classes
virtual void RegisterVehicles(IGameFramework* pGameFramework) = 0;
Parameters |
Description |
IGameFramework* pGameFramework |
A pointer to the game framework |
The vehicle system will read all the xml files which are inside the directory "Scripts/Entities/Vehicles/Implementations/Xml/". All the valid vehicle classes will be registered as game object extension with IGameObjectSystem.
Several default vehicle parts, views, actions and damage behaviors classes are registered in this function as well.
Performs the registration of a class which wants to know when a specific player starts to use a vehicle
virtual void RegisterVehicleUsageEventListener(const EntityId playerId, IVehicleUsageEventListener* pEventListener) = 0;
Parameters |
Description |
const EntityId playerId |
the entity id of the player to listen for. |
pListener |
a pointer to a listener object. |
virtual void Release() = 0;
Registers a newly removed vehicle in the vehicle system
virtual void RemoveVehicle(EntityId entityId) = 0;
virtual void Reset() = 0;
Unregisters class listening to the current player's vehicle.
virtual void UnregisterVehicleUsageEventListener(const EntityId playerId, IVehicleUsageEventListener* pEventListener) = 0;
Parameters |
Description |
const EntityId playerId |
the entity id of the player that the listener is registered for. |
pListener |
the pointer to be removed from the list of callbacks. |
virtual void Update(float deltaTime) = 0;