예제 #1
0
        public void CreateMap(string tmxPath)
        {
            m_blockInfoMap = MapFactory.CreateBlockInfoMap(tmxPath);
            int height = m_blockInfoMap.GetLength(0);
            int width  = m_blockInfoMap.GetLength(1);

            var layoutList = MapFactory.CreateMapLayout(m_blockInfoMap, Vector3.Zero, BlockSize);

            foreach (var layout in layoutList)
            {
                var entity = new GameEntity("map");

                var layoutC = new LayoutComponent();
                layoutC.Transform = layout.Layout;
                entity.AddComponent(layoutC);

                var modelC = new ModelComponent(GameEntityComponent.UpdateLines.PreDraw);
                modelC.ModelContext.EnableCastShadow = true;
                modelC.ModelContext.DrawModel        = m_drawModelList.Find((v) => v.ModelId == layout.ModelId).Model;
                //modelC.ModelContext.DebugModel = debugModel;
                entity.AddComponent(modelC);

                m_mapEntities.Add(entity);
            }
        }
예제 #2
0
        public PlayerEntity()
            : base("player")
        {
            var entitySys = EntitySystem.GetInstance();
            var mapSys    = MapSystem.GetInstance();

            //var path = "Chr/c9000/test.blend";
            //var searchPath = "Chr/c9000";
            var path       = "Chr/c9100/c9100.blend";
            var searchPath = "Chr/c9100";
            var scene      = BlenderScene.FromFile(path);

            if (scene != null)
            {
                var drawModel = DrawModel.FromScene(path + "/draw", scene, searchPath);
                var animRes   = AnimResource.FromBlenderScene(path + "/anim", scene);
                //var debugModel = DrawModel.CreateTangentFrame(path + "/debug", scene);

                if (drawModel.BoneArray.Length != 0)
                {
                    var skeletonC = new SkeletonComponent(drawModel.BoneArray);
                    AddComponent(skeletonC);
                }

                var layoutC = new LayoutComponent();
                layoutC.Transform = Matrix.Identity;
                AddComponent(layoutC);

                //var markerC = new ModelMarkerComponent(scene);
                //AddComponent(markerC);

                var modelC = new ModelComponent(GameEntityComponent.UpdateLines.Draw);
                modelC.ModelContext.EnableCastShadow = true;
                modelC.ModelContext.DrawModel        = drawModel;
                //modelC.ModelContext.DebugModel = debugModel;
                AddComponent(modelC);

                var animC = new AnimComponent(animRes);
                AddComponent(animC);

                var behaviorC = new ChrBehaviorComponent();
                AddComponent(behaviorC);

                var minimapC = new MinimapComponent();
                AddComponent(minimapC);

                MapLocation startLocation = mapSys.GetStartInfo();
                //var inputC = new GodViewInputComponent();
                var inputC = new FpsInputComponent(startLocation);
                AddComponent(inputC);
            }
        }