当前位置: 首页>>代码示例>>C#>>正文


C# IWorld.AddObject方法代码示例

本文整理汇总了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);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:18,代码来源:BallThrowBepu.cs

示例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);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:19,代码来源:BallThrowBepu.cs

示例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)
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:WorldLoader.cs


注:本文中的IWorld.AddObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。