예제 #1
0
        public static void InitializeTest()
        {
            World world = new World();
            CollisionMesh mesh = Resources.ResourceCache.Instance.GetCollisionMesh("castle.cm");

            CollisionOctree tree = CollisionOctree.FromMesh(mesh, 0, 0, 0, 30, 2, 200);
            StaticMesh worldMesh = new StaticMesh(tree, CollisionDataType.CollisionOctree,
                Resources.ResourceCache.Instance.GetRenderingData("castle2.x"), new MyVector(0, 0, 0));
            world.AddObject(worldMesh);
        }
예제 #2
0
        //public static World FromFile(string fileName)
        //{
        //    World world = new World();
        //    MapData data = MapData.FromFile(fileName);
        //    world.gameObjects.AddRange(data.GameObjects);
        //    foreach (GameObject obj in data.GameObjects)
        //    {
        //        world.AddObject(obj);
        //    }
        //    return world;
        //}
        public static void FromFileBkg(string fileName, ProgressReporter reporter)
        {
            World world = new World();

            MapData.FromFileBkg(fileName, reporter);
            if (reporter.Data == null)
                throw new Exception("nie udao sie wczytac mapy!!"); //zle poszlo
            //reporter.Complete = false;

            foreach (IGameObject obj in ((MapData)reporter.Data).GameObjects)
            {
                //if (obj is RespawnPoint)
                //{
                //    world.respawnPoints.Add(obj as RespawnPoint);
                //    //((RespawnPoint)obj).
                //}
                //else
                //{
                world.AddObject(obj);
                //}

                //prawdopodobnie zbêdne
                //if (obj is IUpdateable)
                //{
                //    GM.AppWindow.AddUpdateableItem(obj as IUpdateable);
                //}
            }
            world.environment = Graphics.Environment.FromFile(fileName);

            reporter.Data = world;
            reporter.Complete = true;
        }