public override WorldObject CreateWorldObject(Transform transform = null) { WorldObject baseObj = new EmptyObjectBase(WorldPosition, meta: MetaData).CreateWorldObject(transform); Vec2i dir = new Vec2i(0, 1); if (HasMetaData() && GetMetaData().Direction != null) { dir = GetMetaData().Direction; } WorldObjectMetaData door1Dir = new WorldObjectMetaData(direction: Vec2i.Rotate(new Vec2i(0, 1), dir)); WorldObjectMetaData door2Dir = new WorldObjectMetaData(direction: Vec2i.Rotate(new Vec2i(0, -1), dir)); WorldObject baseDoor = new WoodDoor(new Vec2i(1, 0), door1Dir, onDoorOpen: OnEntityEnter).CreateWorldObject(baseObj.transform); WorldObject secondDoor = new WoodDoor(new Vec2i(3, 0), door2Dir, onDoorOpen: OnEntityEnter).CreateWorldObject(baseObj.transform); Vec2i[] rockPos = new Vec2i[] { new Vec2i(0, 0), new Vec2i(0, 1), new Vec2i(0, 2), new Vec2i(0, 3), new Vec2i(1, 3), new Vec2i(2, 3), new Vec2i(3, 3), new Vec2i(3, 3), new Vec2i(3, 2), new Vec2i(3, 1), new Vec2i(3, 0) }; GenerationRandom genRan = new GenerationRandom(WorldPosition.x << 16 + WorldPosition.z); foreach (Vec2i v in rockPos) { for (int y = 0; y < 3; y++) { Rock r = new Rock(v, Vector3.up * y + new Vector3(1, 0, 1) * 0.5f, rockSize: 1.5f); r.SetRandom(genRan); r.CreateWorldObject(baseObj.transform); } } for (int x = 1; x < 4; x++) { for (int z = 1; z < 4; z++) { new Rock(new Vec2i(x, z), new Vector3(0, 2, 0), rockSize: 2).CreateWorldObject(baseObj.transform); } } return(baseObj); }
public MainForm(GameApplication apseApplication) { this.application = apseApplication; Panel Pul = new Panel(); Pul.Position = new Point(1, 0); Pul.Width = GameClass.TestWindow.Width - 1; Pul.Height = 30; Pul.Anchor = Aligment.Right | Aligment.Left; this.Items.Add(Pul); { DragDropPanel voxap = new DragDropPanel(); voxap.Position = new Point(10, 75 + 250); voxap.Width = 200; voxap.Height = 250; { int libe_pack = 10; { SelectionName = new Label(); SelectionName.Text = "(NULL; -1)"; SelectionName.AutoSize(); SelectionName.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(SelectionName); } { Button bt = new Button(); bt.Text = "Создать Камаз"; bt.AutoSize(); bt.Click += (sender, args) => { CarObjectKamaz vs = new CarObjectKamaz(); vs.Position = new JVector(0f, 4f, 0f); application.InstanceFromGame.AddObject(vs); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Создать Пикап"; bt.AutoSize(); bt.Click += (sender, args) => { CarObjectPickUp vs = new CarObjectPickUp(); vs.Position = new JVector(0f, 4f, 0f); application.InstanceFromGame.AddObject(vs); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Создать куб"; bt.AutoSize(); bt.Click += (sender, args) => { BoxObject bbox1 = new BoxObject(); bbox1.Position = new JVector(2f, 6f, 0f); application.InstanceFromGame.AddObject(bbox1); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Создать планк"; bt.AutoSize(); bt.Click += (sender, args) => { WoodPlank bbox1 = new WoodPlank(); bbox1.Position = new JVector(2f, 6f, 0f); application.InstanceFromGame.AddObject(bbox1); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Создать дверь"; bt.AutoSize(); bt.Click += (sender, args) => { WoodDoor bbox1 = new WoodDoor(); bbox1.Position = new JVector(2f, 6f, 0f); application.InstanceFromGame.AddObject(bbox1); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } } this.Items.Add(voxap); } { DragDropPanel voxap = new DragDropPanel(); voxap.Position = new Point(10, 60); voxap.Width = 300; voxap.Height = 250; { int libe_pack = 10; { Button bt = new Button(); bt.Text = "Сохранить карту"; bt.AutoSize(); bt.Click += (sender, args) => { //if(File.Exists("./map.eemx")) // File.Delete("./map.eemx"); //using (Stream bl = File.OpenWrite("./map.eemx")) //{ // MapLoader.Save(bl, application.InstanceFromGame); //} }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Загрузить карту"; bt.AutoSize(); bt.Click += (sender, args) => { //using (Stream bl = File.OpenRead("./map.eemx")) //{ // MapLoader.Load(bl, application.InstanceFromGame); //} }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Перегрузить шейдер"; bt.AutoSize(); bt.Click += (sender, args) => { //global::EmyEngine.EE.СurrentResources.GetResource("/shaders/new/shader.vs").Data = File.ReadAllBytes("./bin/shaders/new/shader.vs"); //global::EmyEngine.EE.СurrentResources.GetResource("/shaders/new/shader.fs").Data = File.ReadAllBytes("./bin/shaders/new/shader.fs"); //application.Shader3DMain = new ShaderNew(); //((ShaderNew)application.Shader3DMain).ShadowMapObject = application.FraemBufferMain.DepthTextureObject; }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { CheckBox bt = new CheckBox(); bt.Text = "Дебуг дравв"; bt.ValueChanged += (sender, args) => { if (bt.Checked) { application.InstanceFromGame.EnableDebugDraweble(); } else { application.InstanceFromGame.DisableDebugDraweble(); } }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { CheckBox bt = new CheckBox(); bt.Text = "D* Shader Material"; bt.ValueChanged += (sender, args) => { if (bt.Checked) { ((ShaderNew)application.Shader3DMain).EnableMaterials = false; } else { ((ShaderNew)application.Shader3DMain).EnableMaterials = true; } }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } { Button bt = new Button(); bt.Text = "Закрыть"; bt.AutoSize(); bt.Click += (sender, args) => { GameClass.TestWindow.Close(); }; bt.Position = new Point(10, libe_pack); libe_pack += 30; voxap.Items.Add(bt); } } this.Items.Add(voxap); } }