ObjectLibrary
From Elemental
ObjectLibrary searches Xml and automatically loads the following GameObject types:
Players - Generic AI and Human Characters. Terrain - Generic land masses. Billboard - 2D sprites which always face the viewer. Prop - 3D level- or mass-produced objects. GpuObject - 3D Gpu-based objects.
ObjectLibrary provides access to the following lists during each GameObject::Update() cycle:
GameObjectList - List of all user-defined, overridden GameObjects loaded from xml. PropList - List of all xml-defined 3D level- or mass-produced objects. GpuObjectList - List of all xml-defined 3D or 2D Gpu-based objects. BillboardList - List of all xml-defined and user-defined 2D sprites which always face the viewer.
GameObjects are allowed to inspect and modify these lists, which include all other GameObjects currently loaded.
This defines a physical interaction system that supports custom collision responses and game interactions based on the object type.
public override void Update(ref ObjectLibrary objectLibrary)
{
for (int i = 0; i < objectLibrary.bots.Count; i++)
{
if (objectLibrary.bots[i].IsAlive())
{
// Shoot at bot
}
}
}
Attack Methods
It is possible to create alternate attack methods using GameObject overrides. Object Library supplies three types of attack methods by default:
Bullet - Projectile which (nearly) instantaneously collides with the target object. Grenade - Projectile which travels using Newtonian physics before reaching it's target object. GpuParticle - Non-colliding particles that can be used in large batch numbers (such as snow storms or hail).