public override void initialization() { START_initialization(); float x = 0, y = 0, z = 0; if (!Projectile.jp.Loaded) { ShaderedScene.CalculateFromMaptoGraphical(Explosion.exp.ExplosionCenter, ref x, ref y, ref z); } else { x = Projectile.jp.AbsoluteEstimatedLocation().x; y = Projectile.jp.AbsoluteEstimatedLocation().y; z = Projectile.jp.AbsoluteEstimatedLocation().z; } ForEachTemporalList(this, TemporalList, x, y, z); //if (Projectile.jp.Loaded) // ForEachTemporalList(Projectile.jp.ProjectileParts); END_initialization(); base.LastCount = vertices.Count(); }
public static void ForEachTemporalList(DataForDraw_angled Data, List <CubicalMemory.Cube> Temper, float cx, float cy, float cz, bool ShowAlways = false) { float x = 0, y = 0, z = 0; //Так по поводу взрыва. Давай все мерить в TNT эквиваленте. float Me = (float)Projectile.settings.Me; //mass of the fragmenting casing float Mc = (float)Projectile.settings.Mc; //mass of the explosive charge float K = (float)Projectile.settings.K; //Geometrical Constant for cube float dE = (float)Projectile.settings.dE; // J/kg Heat of TNT Explosion double rightpart = (Mc / Me) / (1 + K * (Mc / Me)); float V = (float)Math.Sqrt(2 * dE * (rightpart)); ExplosionVelocity = V; foreach (var cube in Temper) { ShaderedScene.CalculateFromMaptoGraphical(cube, ref x, ref y, ref z); float Vx = x - cx, Vy = y - cy, Vz = z - cz; float Range = (float)Math.Sqrt((double)Vx * Vx + Vy * Vy + Vz * Vz); Vx *= V / (Range * Range); Vy *= V / (Range * Range); Vz *= V / (Range * Range); float Velocity = (float)Math.Sqrt((double)Vx * Vx + Vy * Vy + Vz * Vz); if (ShowAlways || Velocity > 10) { cube.IsTakenForExplosion = true; Data.Draw_Quad_Full_Sunsided_angled(x, y, z, Vx, Vy, Vz, localed_range, cube.color, 0, true); } } }
public void PlaceTheBombAt(CubicalMemory.Cube cube) { float x1 = 0, y1 = 0, z1 = 0; ShaderedScene.CalculateFromMaptoGraphical(cube, ref x1, ref y1, ref z1); Explosion.exp.SetBombLocation(x1, y1, z1); }
public override void initialization() { START_initialization(); //Ghost Cube if (StaticSettings.S.GhostCube_Add_in_Data_For_Draw) { bool thing = false; bool found = false; try { thing = Scene.SS.env.cub_mem.world.World_as_Whole [Scene.SS.env.player.coords.Player_chunk_lookforcube.x] [Scene.SS.env.player.coords.Player_chunk_lookforcube.z].cubes [Scene.SS.env.player.coords.Player_cubical_lookforcube.x] [Scene.SS.env.player.coords.Player_cubical_lookforcube.y] [Scene.SS.env.player.coords.Player_cubical_lookforcube.z].IsFilled; found = true; } catch (Exception) { found = false; } if (found) { System.Drawing.Color result = System.Drawing.Color.Gray; if (thing) { System.Drawing.Color colour = Scene.SS.env.cub_mem.world.World_as_Whole [Scene.SS.env.player.coords.Player_chunk_lookforcube.x] [Scene.SS.env.player.coords.Player_chunk_lookforcube.z].cubes [Scene.SS.env.player.coords.Player_cubical_lookforcube.x] [Scene.SS.env.player.coords.Player_cubical_lookforcube.y] [Scene.SS.env.player.coords.Player_cubical_lookforcube.z].color; result = System.Drawing.Color.FromArgb ( (int)((float)(GraphicalOverlap.GO_color.R + colour.R) / 2), (int)((float)(GraphicalOverlap.GO_color.G + colour.G) / 2), (int)((float)(GraphicalOverlap.GO_color.B + colour.B) / 2) ); } else { result = GraphicalOverlap.GO_color; } ShaderedScene.CalculateFromMaptoGraphical(Scene.SS.env.player.coords.Player_chunk_lookforcube, Scene.SS.env.player.coords.Player_cubical_lookforcube, ref x, ref y, ref z); Draw_Quad_Full_Sunsided_angled(x, y, z, 0.0f, 0.0f, 0.0f, localed_range, result, 0, true); } } END_initialization(); base.LastCount = vertices.Count(); }
public override void initialization() { START_initialization(); foreach (var cube in TemporalList) { ShaderedScene.CalculateFromMaptoGraphical(cube, ref x, ref y, ref z); Draw_Quad_Full_Sunsided_angled(x, y, z, cube.FallingStartingTime, cube.FallingFromHeight * (CubicalMemory.Cube.rangeOfTheEdge), 0.0f, localed_range, cube.color, 0, true); } END_initialization(); base.LastCount = vertices.Count(); }
public void SetHpos2() { if (hpos1 == null) { MessageBox.Show("Select Hpos1(K) before Hpos2(U)!"); return; } hpos2 = Cube_Selection.Decide_Position_To_Place_Cube(false); ShaderedScene.CalculateFromMaptoGraphical(hpos1, ref hposition1); ShaderedScene.CalculateFromMaptoGraphical(hpos2, ref hposition2); sd.Set_Center((hposition1 + hposition2) / 2); GatherCubes(); }
public override void initialization() { START_initialization(); int i = 0; int j = 0; int value = 0; if ((value = Scene.SS.env.player.coords.Player_chunk_position.x - StaticSettings.S.RangeOfView) > 0) { i = value + 1; } else { i = 0; } for (; i < Scene.SS.env.cub_mem.world.World_as_Whole.Count() && i < Scene.SS.env.player.coords.Player_chunk_position.x + StaticSettings.S.RangeOfView; i++) { if ((value = Scene.SS.env.player.coords.Player_chunk_position.z - StaticSettings.S.RangeOfView) > 0) { j = value + 1; } else { j = 0; } for (; j < Scene.SS.env.cub_mem.world.World_as_Whole[i].Count() && j < Scene.SS.env.player.coords.Player_chunk_position.z + StaticSettings.S.RangeOfView; j++) { var XYworld = Scene.SS.env.cub_mem.world.World_as_Whole[i][j]; if (Math.Abs(XYworld.xz.x - Scene.SS.env.player.coords.Player_chunk_position.x) < StaticSettings.S.RangeOfView && Math.Abs(XYworld.xz.z - Scene.SS.env.player.coords.Player_chunk_position.z) < StaticSettings.S.RangeOfView) { foreach (var Xcube in XYworld.cubes) { foreach (var XYcube in Xcube) { foreach (var XYZcube in XYcube) { if (XYZcube.IsFilled && !XYZcube.IsTakenForExplosion) { ShaderedScene.CalculateFromMaptoGraphical(XYZcube, ref x, ref y, ref z); //POINT OF VIEWER Scene.SS.env.player.NormalizedToXYWorld.x = Scene.SS.env.player.coords.Player_precise_stepback.x - x; Scene.SS.env.player.NormalizedToXYWorld.y = Scene.SS.env.player.coords.Player_precise_stepback.y - y; Scene.SS.env.player.NormalizedToXYWorld.z = Scene.SS.env.player.coords.Player_precise_stepback.z - z; float range = GeneralProgrammingStuff.vec3_range(Scene.SS.env.player.NormalizedToXYWorld); GeneralProgrammingStuff.vec3_normalize(ref Scene.SS.env.player.NormalizedToXYWorld, range); Scene.SS.env.player.coords.LookForCube(); float scalar = GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.NormalizedToXYWorld, Scene.SS.env.player.coords.NormalizedLook); //POINT OF VIEWER if (!StaticSettings.S.RealoderCauseOfPointOfView || scalar > 0) { //if (!StaticSettings.S.RealoderCauseOfSunSided || // XYworld.xz.x == Scene.SS.env.player.coords.Player_chunk_position.x // && XYworld.xz.z == Scene.SS.env.player.coords.Player_chunk_position.z) // Draw_Quad_Full_Sunsided(x, y, z, localed_range, XYZcube.color, true); //Вроде обычный куб. //else if (!StaticSettings.S.PointOfView_Circled_Visible_Cubes || range < CubicalMemory.Cube.rangeOfTheEdge * CubicalMemory.Chunk.Width * (StaticSettings.S.RangeOfView)) { Draw_Quad_Full_Sunsided_not_angled(x, y, z, localed_range, XYZcube.color); } } } } } } } } } END_initialization(); }
public void Exploding_Rewriter() { if (ExplosionCenter != null) { Point2Int Bomb_chunk_position = new Point2Int(0, 0); Point3Int Bomb_cubical_position = new Point3Int(0, 0, 0); Scene.SS.env.player.coords.Reverse_presice_to_map_coords(Bomb_precise_position, ref Bomb_chunk_position, ref Bomb_cubical_position); int Range_of_chunk_explosion = (int)Projectile.settings.Explosion_radius; //DataForDraw_ExplodingList.TemporalList.Clear(); int i = 0; int j = 0; int value = 0; if ((value = Bomb_chunk_position.x - Range_of_chunk_explosion) > 0) { i = value; } else { i = 0; } for (; i < Scene.SS.env.cub_mem.world.World_as_Whole.Count() && i < Bomb_chunk_position.x + Range_of_chunk_explosion; i++) { if ((value = Bomb_chunk_position.z - Range_of_chunk_explosion) > 0) { j = value; } else { j = 0; } for (; j < Scene.SS.env.cub_mem.world.World_as_Whole[i].Count() && j < Bomb_chunk_position.z + Range_of_chunk_explosion; j++) { var XYworld = Scene.SS.env.cub_mem.world.World_as_Whole[i][j]; if (Math.Abs(XYworld.xz.x - Bomb_chunk_position.x) < Range_of_chunk_explosion && Math.Abs(XYworld.xz.z - Bomb_chunk_position.z) < Range_of_chunk_explosion) { foreach (var Xcube in XYworld.cubes) { foreach (var XYcube in Xcube) { foreach (var XYZcube in XYcube) { if (XYZcube.IsFilled && !XYZcube.IsTakenForExplosion) { ShaderedScene.CalculateFromMaptoGraphical(XYZcube, ref x, ref y, ref z); //POINT OF VIEWER vec3 range_to_cube = new vec3(0, 0, 0); range_to_cube.x = Bomb_precise_position.x - x; range_to_cube.y = Bomb_precise_position.y - y; range_to_cube.z = Bomb_precise_position.z - z; float range = GeneralProgrammingStuff.vec3_range(range_to_cube); if (range < CubicalMemory.Cube.rangeOfTheEdge * Projectile.settings.Explosion_radius) { XYZcube.FallingStartingTime = Explosion.exp.StartingTime; DataForDraw_ExplodingList.TemporalList.Add(XYZcube); //Draw_Quad_Full_Sunsided_not_angled(x, y, z, localed_range, XYZcube.color); } } } } } } } } ExplosionCenter.IsTakenForExplosion = true; } }
public void GatherCubes() { Loaded = true; if (ProjectileParts.Count() != 0) { foreach (var item in ProjectileParts) { item.IsTakenForExplosion = false; } } ProjectileParts.Clear(); sd.Set_Center((hposition1 + hposition2) / 2); vec3 pos_min = new vec3(Math.Min(hposition1.x, hposition2.x), Math.Min(hposition1.y, hposition2.y), Math.Min(hposition1.z, hposition2.z)); vec3 pos_max = new vec3(Math.Max(hposition1.x, hposition2.x), Math.Max(hposition1.y, hposition2.y), Math.Max(hposition1.z, hposition2.z)); half_height = hposition2.y - hposition1.y; vec3 cubeposition = new vec3(0, 0, 0); foreach (var XWorld in Scene.SS.env.cub_mem.world.World_as_Whole) { foreach (var XYWorld in XWorld) { foreach (var Xcube in XYWorld.cubes) { foreach (var XYcube in Xcube) { foreach (var XYZcube in XYcube) { ShaderedScene.CalculateFromMaptoGraphical(XYZcube, ref cubeposition); if (cubeposition.x >= pos_min.x && cubeposition.y >= pos_min.y && cubeposition.z >= pos_min.z && cubeposition.x <= pos_max.x && cubeposition.y <= pos_max.y && cubeposition.z <= pos_max.z ) { vec3 ranged = cubeposition - sd.Get_Center(); double range = Math.Sqrt(ranged.x * ranged.x + ranged.y * ranged.y + ranged.z * ranged.z); if (range < CenterCube_RangeMax) { CenterCube_RangeMax = range; CenterCube = XYZcube; } if (XYZcube.IsFilled) { XYZcube.IsTakenForExplosion = true; ProjectileParts.Add(XYZcube); } } } } } } } Scene.SS.ProjectileList.Reloader(); StaticSettings.S.RealoderCauseOfBuildingBlocks = true; }