本文整理汇总了C#中IWorld.AddObject方法的典型用法代码示例。如果您正苦于以下问题:C# IWorld.AddObject方法的具体用法?C# IWorld.AddObject怎么用?C# IWorld.AddObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWorld
的用法示例。
在下文中一共展示了IWorld.AddObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BallThrowBepu
public BallThrowBepu(IScene scene, GraphicFactory factory, GestureType type)
: base(scene)
{
this.Start();
this.factory = factory;
_mundo = scene.World;
SimpleConcreteGestureInputPlayable SimpleConcreteGestureInputPlayable = new SimpleConcreteGestureInputPlayable(type,
(sample) =>
{
IObject physObj = SpawnPrimitive(_mundo.CameraManager.ActiveCamera.Position, Matrix.CreateRotationX(0.5f));
physObj.PhysicObject.Velocity = (_mundo.CameraManager.ActiveCamera.Target - _mundo.CameraManager.ActiveCamera.Position) * 15.0f;
physObj.Name = "FlyingBall " + ++i;
_mundo.AddObject(physObj);
}
);
scene.BindInput(SimpleConcreteGestureInputPlayable);
}
示例2: BallThrowBepu
public BallThrowBepu(IScene scene, GraphicFactory factory, GestureType type)
: base(scene)
{
this.Start();
this.factory = factory;
_mundo = scene.World;
SimpleConcreteGestureInputPlayable SimpleConcreteGestureInputPlayable = new SimpleConcreteGestureInputPlayable(type,
(sample) =>
{
IObject physObj = SpawnPrimitive(_mundo.CameraManager.ActiveCamera.Position, Matrix.Identity);
physObj.PhysicObject.Velocity = (_mundo.CameraManager.ActiveCamera.Target - _mundo.CameraManager.ActiveCamera.Position) * 10.0f;
physObj.Name = "FlyingBall " + ++i;
_mundo.AddObject(physObj);
(physObj.Material.Shader as ForwardXNABasicShader).BasicEffect.EnableDefaultLighting();
}
);
scene.BindInput(SimpleConcreteGestureInputPlayable);
}
示例3: LoadWorld
public void LoadWorld(GraphicFactory factory, GraphicInfo ginfo, IWorld world, ModelLoaderData worldData)
{
objinfos.Clear();
foreach (var item in worldData.ModelMeshesInfo)
{
if(objinfos.ContainsKey(item.modelName + item.meshIndex))
{
objinfos[item.modelName + item.meshIndex].Add(item);
}
else
{
objinfos[item.modelName + item.meshIndex] = new List<ObjectInformation>();
objinfos[item.modelName + item.meshIndex].Add(item);
}
}
foreach (var item in objinfos.Keys)
{
if (OnCreateIObject != null)
{
IObject[] obj = OnCreateIObject(world, factory, ginfo, objinfos[item].ToArray());
if (obj != null)
{
foreach (var ob in obj)
{
world.AddObject(ob);
}
}
}
else
{
foreach (var obj in WorldLoader.CreateOBJ(world, factory, ginfo, objinfos[item].ToArray()))
{
world.AddObject(obj);
}
}
}
foreach (var item in worldData.ConstraintInfo)
{
List<IObject> obb = world.Objects.ToList();
IObject o1 = obb.First(delegate(IObject o) { return o.Name == item.bodyA; });
IObject o2 = obb.First(delegate(IObject o) { return o.Name == item.bodyB; });
if (o1.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT && o2.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT)
{
if (OnCreateIConstraint != null)
{
IPhysicConstraint constr = OnCreateIConstraint(world, factory, ginfo, item, o1, o2);
if (constr != null)
world.PhysicWorld.AddConstraint(constr);
}
else
{
IPhysicConstraint constr = WorldLoader.CreateConstraint(world, factory, ginfo, item, o1, o2);
world.PhysicWorld.AddConstraint(constr);
}
}
}
foreach (var item in worldData.LightsInfo)
{
if (OnCreateILight != null)
{
ILight l = OnCreateILight(world, factory, ginfo, item);
if (l != null)
world.AddLight(l);
}
else
{
world.AddLight(item);
}
}
foreach (var item in worldData.CameraInfo)
{
if (OnCreateICamera != null)
{
ICamera cam = OnCreateICamera(world, factory, ginfo, item);
if (cam != null)
world.CameraManager.AddCamera(cam);
}
else
{
world.CameraManager.AddCamera(WorldLoader.CreateCamera(world, factory, ginfo, item));
}
}
foreach (var item in worldData.DummyInfo)
{
if (OnProcessDummies != null)
OnProcessDummies(world, item);
}
foreach (var item in worldData.ParticleInfo)
//.........这里部分代码省略.........