diff --git a/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png new file mode 100644 index 0000000..13d2000 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png.import b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png.import new file mode 100644 index 0000000..be87349 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://womb24ctpfbs" +path="res://.godot/imported/PreviewTransition.png-b83b4ced379d583acb727e75fbc9fb96.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/map/PreviewTransition.png" +dest_files=["res://.godot/imported/PreviewTransition.png-b83b4ced379d583acb727e75fbc9fb96.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png new file mode 100644 index 0000000..4c71a5f --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png.import b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png.import new file mode 100644 index 0000000..b6b8603 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/PreviewTransition2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://unjhskw8mgdy" +path="res://.godot/imported/PreviewTransition2.png-ee017f2654dd639c4b784a54b4e7b40c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/map/PreviewTransition2.png" +dest_files=["res://.godot/imported/PreviewTransition2.png-ee017f2654dd639c4b784a54b4e7b40c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs index d472b66..ad22bd6 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs @@ -141,10 +141,14 @@ roomPreinstall.Pretreatment(random); } - var doors = roomInfo.GetForwardDoors(); //铺过道 - foreach (var doorInfo in doors) + foreach (var doorInfo in roomInfo.Doors) { + //必须是正向门 + if (!doorInfo.IsForward) + { + continue; + } //普通的直线连接 var doorDir1 = doorInfo.Direction; var doorDir2 = doorInfo.ConnectDoor.Direction; diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs index fe7f2f7..89cfd54 100644 --- a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs @@ -428,24 +428,6 @@ } /// - /// 获取该房间所有正向的门 - /// - public RoomDoorInfo[] GetForwardDoors() - { - var temp = new List(); - foreach (var doorInfo in Doors) - { - if (doorInfo.IsForward) - //if (doorInfo.ConnectRoom.Id > Id) - { - temp.Add(doorInfo); - } - } - - return temp.ToArray(); - } - - /// /// 清除迷雾 /// public void ClearFog() diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 4748ecf..9ad2b4f 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -149,6 +149,8 @@ public const string resource_sprite_effects_weapon_MeleeAttack1_png = "res://resource/sprite/effects/weapon/MeleeAttack1.png"; public const string resource_sprite_effects_weapon_ShotFire_png = "res://resource/sprite/effects/weapon/ShotFire.png"; public const string resource_sprite_map_door1_down_png = "res://resource/sprite/map/door1_down.png"; + public const string resource_sprite_map_PreviewTransition_png = "res://resource/sprite/map/PreviewTransition.png"; + public const string resource_sprite_map_PreviewTransition2_png = "res://resource/sprite/map/PreviewTransition2.png"; public const string resource_sprite_map_WallTransition1_png = "res://resource/sprite/map/WallTransition1.png"; public const string resource_sprite_map_WallTransition2_png = "res://resource/sprite/map/WallTransition2.png"; public const string resource_sprite_map_WallTransition3_png = "res://resource/sprite/map/WallTransition3.png"; diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index 5801dfc..94360d4 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -199,7 +199,7 @@ World = GameApplication.Instance.CreateNewWorld(); yield return 0; //生成地牢房间 - var random = new SeedRandom(); + var random = new SeedRandom(204343260); _dungeonGenerator = new DungeonGenerator(CurrConfig, random); _dungeonGenerator.Generate(); yield return 0; @@ -431,7 +431,7 @@ private void CreateRoomFogMask(RoomInfo roomInfo) { var roomFog = new FogMask(); - roomFog.BlendMode = Light2D.BlendModeEnum.Mix; + //roomFog.BlendMode = Light2D.BlendModeEnum.Add; roomFog.Name = "FogMask" + roomFog.IsDestroyed; float alpha; if (roomInfo.RoomType == DungeonRoomType.Inlet) //起始房间没有迷雾 @@ -446,86 +446,113 @@ World.FogMaskRoot.AddChild(roomFog); roomInfo.FogMask = roomFog; - - //正向门 - var roomDoorInfos = roomInfo.GetForwardDoors(); + //生成通道迷雾 - foreach (var roomDoorInfo in roomDoorInfos) + foreach (var roomDoorInfo in roomInfo.Doors) { - Rect2I calcRect; - Rect2I fogAreaRect; - if (!roomDoorInfo.HasCross) + //必须是正向门 + if (!roomDoorInfo.IsForward) { - calcRect = roomDoorInfo.GetAisleRect(); - fogAreaRect = calcRect; - if (roomDoorInfo.Direction == DoorDirection.E || roomDoorInfo.Direction == DoorDirection.W) + Rect2I calcRect; + Rect2I fogAreaRect; + if (!roomDoorInfo.HasCross) { - calcRect.Position += new Vector2I(2, 0); - calcRect.Size -= new Vector2I(4, 0); + calcRect = roomDoorInfo.GetAisleRect(); + fogAreaRect = calcRect; + if (roomDoorInfo.Direction == DoorDirection.E || roomDoorInfo.Direction == DoorDirection.W) + { + calcRect.Position += new Vector2I(2, 0); + calcRect.Size -= new Vector2I(4, 0); + } + else + { + calcRect.Position += new Vector2I(0, 2); + calcRect.Size -= new Vector2I(0, 4); + } } else { - calcRect.Position += new Vector2I(0, 2); - calcRect.Size -= new Vector2I(0, 4); - } - } - else - { - var aisleRect = roomDoorInfo.GetCrossAisleRect(); - calcRect = aisleRect.CalcAisleRect(); - fogAreaRect = calcRect; + var aisleRect = roomDoorInfo.GetCrossAisleRect(); + calcRect = aisleRect.CalcAisleRect(); + fogAreaRect = calcRect; - switch (roomDoorInfo.Direction) - { - case DoorDirection.E: - calcRect.Position += new Vector2I(2, 0); - calcRect.Size -= new Vector2I(2, 0); - break; - case DoorDirection.W: - calcRect.Size -= new Vector2I(2, 0); - break; - case DoorDirection.S: - calcRect.Position += new Vector2I(0, 2); - calcRect.Size -= new Vector2I(0, 2); - break; - case DoorDirection.N: - calcRect.Size -= new Vector2I(0, 2); - break; + switch (roomDoorInfo.Direction) + { + case DoorDirection.E: + calcRect.Position += new Vector2I(2, 0); + calcRect.Size -= new Vector2I(2, 0); + break; + case DoorDirection.W: + calcRect.Size -= new Vector2I(2, 0); + break; + case DoorDirection.S: + calcRect.Position += new Vector2I(0, 2); + calcRect.Size -= new Vector2I(0, 2); + break; + case DoorDirection.N: + calcRect.Size -= new Vector2I(0, 2); + break; + } + + switch (roomDoorInfo.ConnectDoor.Direction) + { + case DoorDirection.E: + calcRect.Position += new Vector2I(2, 0); + calcRect.Size -= new Vector2I(2, 0); + break; + case DoorDirection.W: + calcRect.Size -= new Vector2I(2, 0); + break; + case DoorDirection.S: + calcRect.Position += new Vector2I(0, 2); + calcRect.Size -= new Vector2I(0, 2); + break; + case DoorDirection.N: + calcRect.Size -= new Vector2I(0, 2); + break; + } } - - switch (roomDoorInfo.ConnectDoor.Direction) - { - case DoorDirection.E: - calcRect.Position += new Vector2I(2, 0); - calcRect.Size -= new Vector2I(2, 0); - break; - case DoorDirection.W: - calcRect.Size -= new Vector2I(2, 0); - break; - case DoorDirection.S: - calcRect.Position += new Vector2I(0, 2); - calcRect.Size -= new Vector2I(0, 2); - break; - case DoorDirection.N: - calcRect.Size -= new Vector2I(0, 2); - break; - } + + //过道迷雾遮罩 + var aisleFog = new FogMask(); + //aisleFog.BlendMode = Light2D.BlendModeEnum.Add; + aisleFog.InitFog(calcRect.Position, calcRect.Size); + World.FogMaskRoot.AddChild(aisleFog); + roomDoorInfo.FogMask = aisleFog; + roomDoorInfo.ConnectDoor.FogMask = aisleFog; + + //过道迷雾区域 + var fogArea = new AisleFogArea(); + fogArea.Init(roomDoorInfo, + new Rect2I(fogAreaRect.Position * GameConfig.TileCellSize, + fogAreaRect.Size * GameConfig.TileCellSize)); + roomDoorInfo.AisleFogArea = fogArea; + roomDoorInfo.ConnectDoor.AisleFogArea = fogArea; + World.AffiliationAreaRoot.AddChild(fogArea); } - - //过道迷雾遮罩 - var aisleFog = new FogMask(); - aisleFog.BlendMode = Light2D.BlendModeEnum.Mix; - aisleFog.InitFog(calcRect.Position, calcRect.Size); - World.FogMaskRoot.AddChild(aisleFog); - roomDoorInfo.FogMask = aisleFog; - roomDoorInfo.ConnectDoor.FogMask = aisleFog; - - //过道迷雾区域 - var fogArea = new AisleFogArea(); - fogArea.Init(roomDoorInfo, new Rect2I(fogAreaRect.Position * GameConfig.TileCellSize, fogAreaRect.Size * GameConfig.TileCellSize)); - roomDoorInfo.AisleFogArea = fogArea; - roomDoorInfo.ConnectDoor.AisleFogArea = fogArea; - World.AffiliationAreaRoot.AddChild(fogArea); + + if (roomDoorInfo.Direction == DoorDirection.E) + { + var previewTexture = + ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_map_PreviewTransition_png); + var previewFog = new PointLight2D(); + previewFog.Texture = previewTexture; + //previewFog.BlendMode = Light2D.BlendModeEnum.Add; + previewFog.GlobalPosition = roomDoorInfo.Door.GlobalPosition + new Vector2(16, 0); + previewFog.RotationDegrees = 90; + World.FogMaskRoot.AddChild(previewFog); + } + else if (roomDoorInfo.Direction == DoorDirection.W) + { + var previewTexture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_map_PreviewTransition2_png); + var previewFog = new PointLight2D(); + previewFog.Texture = previewTexture; + //previewFog.BlendMode = Light2D.BlendModeEnum.Add; + previewFog.GlobalPosition = roomDoorInfo.Door.GlobalPosition + new Vector2(16, 0); + previewFog.RotationDegrees = 90; + World.FogMaskRoot.AddChild(previewFog); + } + } }