From 38c0bdff2a53c3f4b4945d033e9b859c17a551af Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Sat, 24 Aug 2024 22:49:59 +0800 Subject: [PATCH] =?UTF-8?q?Join=20the=20fog=20of=20war.=20=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=88=98=E4=BA=89=E8=BF=B7=E9=9B=BE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefab/MainCamera.tscn | 3 ++ prefab/entitys/Character.tscn | 3 -- .../dungeon/horizontalCorridor.tscn | 13 +++++-- .../dungeon/horizontalCorridorWithSewer.tscn | 13 +++++-- prefab/roomTemplates/dungeon/initialRoom.tscn | 13 +++++-- prefab/roomTemplates/dungeon/utilityRoom.tscn | 13 +++++-- project.godot | 9 +++-- scenes/game.tscn | 3 ++ scripts/AssetHolder.cs | 23 ++++++++++++ scripts/character/Player.cs | 9 +++++ scripts/loader/sceneLoader/GameSceneLoader.cs | 1 + scripts/loader/uiLoader/SplashScreenLoader.cs | 1 + scripts/map/room/Room.cs | 19 ++++++++++ scripts/projectile/Projectile.cs | 1 - sprites/light/White_100.png | Bin 0 -> 117 bytes sprites/light/White_100.png.import | 34 ++++++++++++++++++ sprites/light/White_25.png | Bin 0 -> 112 bytes sprites/light/White_25.png.import | 34 ++++++++++++++++++ 18 files changed, 174 insertions(+), 18 deletions(-) create mode 100644 prefab/MainCamera.tscn create mode 100644 scripts/AssetHolder.cs create mode 100644 sprites/light/White_100.png create mode 100644 sprites/light/White_100.png.import create mode 100644 sprites/light/White_25.png create mode 100644 sprites/light/White_25.png.import diff --git a/prefab/MainCamera.tscn b/prefab/MainCamera.tscn new file mode 100644 index 0000000..268f676 --- /dev/null +++ b/prefab/MainCamera.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://briehpw3eg1i6"] + +[node name="Camera2D" type="Camera2D"] diff --git a/prefab/entitys/Character.tscn b/prefab/entitys/Character.tscn index 2dbf806..024247a 100644 --- a/prefab/entitys/Character.tscn +++ b/prefab/entitys/Character.tscn @@ -35,9 +35,6 @@ CampId = "Default" shape = SubResource("CapsuleShape2D_bb8wt") debug_color = Color(0.886275, 0, 0.803922, 0.419608) -[node name="Camera2D" type="Camera2D" parent="."] -position_smoothing_enabled = true - [node name="Area2DPickingArea" type="Area2D" parent="."] collision_layer = 0 collision_mask = 8 diff --git a/prefab/roomTemplates/dungeon/horizontalCorridor.tscn b/prefab/roomTemplates/dungeon/horizontalCorridor.tscn index d977bee..c8bd1d7 100644 --- a/prefab/roomTemplates/dungeon/horizontalCorridor.tscn +++ b/prefab/roomTemplates/dungeon/horizontalCorridor.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=4 uid="uid://b0uurp551pku"] +[gd_scene load_steps=9 format=4 uid="uid://b0uurp551pku"] [ext_resource type="TileSet" uid="uid://c4wpp12rr44hi" path="res://tileSets/dungeon.tres" id="1_a15hy"] [ext_resource type="Script" path="res://scripts/map/AiCharacterSpawn.cs" id="2_wamhd"] +[ext_resource type="Texture2D" uid="uid://drw45jlmfo0su" path="res://sprites/light/White_100.png" id="3_0mlbb"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_kiih8"] -size = Vector2(443, 118) +size = Vector2(505, 186) [sub_resource type="RectangleShape2D" id="RectangleShape2D_o85u0"] size = Vector2(20, 48) @@ -27,7 +28,7 @@ source_geometry_group_name = &"navigation_polygon_source_group" collision_mask = 0 [node name="CollisionShape2D" type="CollisionShape2D" parent="RoomArea"] -position = Vector2(256.5, 95) +position = Vector2(255.5, 97) shape = SubResource("RectangleShape2D_kiih8") [node name="RoomSlotList" type="Node2D" parent="."] @@ -74,3 +75,9 @@ tile_set = ExtResource("1_a15hy") use_parent_material = true tile_map_data = PackedByteArray("AAAAAAAAAQAAAAMAAAAAAAEAAQACAAEAAAAAAAIAAQACAAEAAAABAAAAAQABAAIAAAACAAAAAQABAAIAAAADAAAAAQABAAIAAAAEAAAAAQABAAIAAAAHAAAAAQABAAIAAAAIAAAAAQABAAIAAAAJAAAAAQABAAIAAAAKAAAAAQABAAIAAAALAAAAAQABAAIAAAAMAAAAAQABAAIAAAANAAAAAQABAAIAAAAOAAAAAQABAAMAAAAPAAAAAQACAAMAAAAPAAEAAQACAAQAAAAPAAIAAQACAAQAAAABAAUAAQABAAAAAAACAAUAAQABAAAAAAADAAUAAQABAAAAAAAEAAUAAQABAAAAAAAFAAUAAQABAAAAAAAGAAUAAQABAAAAAAAHAAUAAQABAAAAAAAIAAUAAQABAAAAAAAJAAUAAQABAAAAAAAKAAUAAQABAAAAAAALAAUAAQABAAAAAAAMAAUAAQABAAAAAAANAAUAAQABAAAAAAAOAAUAAQABAAAAAAAAAAUAAQAAAAUAAAAPAAUAAQACAAUAAAAFAAAAAQAEAAQAAAAGAAAAAQAEAAQAAAA=") tile_set = ExtResource("1_a15hy") + +[node name="PointLight2D" type="PointLight2D" parent="."] +visible = false +position = Vector2(256, 96.5) +scale = Vector2(15.875, 5.96875) +texture = ExtResource("3_0mlbb") diff --git a/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn b/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn index 9f26957..950216d 100644 --- a/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn +++ b/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=4 uid="uid://dslr5tdbp4noq"] +[gd_scene load_steps=9 format=4 uid="uid://dslr5tdbp4noq"] [ext_resource type="TileSet" uid="uid://c4wpp12rr44hi" path="res://tileSets/dungeon.tres" id="1_rn2om"] [ext_resource type="Script" path="res://scripts/map/AiCharacterSpawn.cs" id="2_7q101"] +[ext_resource type="Texture2D" uid="uid://drw45jlmfo0su" path="res://sprites/light/White_100.png" id="3_m3aye"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_kiih8"] -size = Vector2(441, 122) +size = Vector2(505, 188) [sub_resource type="RectangleShape2D" id="RectangleShape2D_o85u0"] size = Vector2(20, 48) @@ -27,7 +28,7 @@ source_geometry_group_name = &"navigation_polygon_source_group" collision_mask = 0 [node name="CollisionShape2D" type="CollisionShape2D" parent="RoomArea"] -position = Vector2(255.5, 97) +position = Vector2(256.5, 95) shape = SubResource("RectangleShape2D_kiih8") [node name="RoomSlotList" type="Node2D" parent="."] @@ -75,3 +76,9 @@ tile_set = ExtResource("1_rn2om") use_parent_material = true tile_map_data = PackedByteArray("AAAAAAAAAQAAAAMAAAAAAAEAAQACAAEAAAAAAAIAAQACAAEAAAABAAAAAQABAAIAAAACAAAAAQABAAIAAAADAAAAAQABAAIAAAAEAAAAAQABAAIAAAAFAAAAAQABAAIAAAAGAAAAAQABAAIAAAAHAAAAAQABAAIAAAAIAAAAAQABAAIAAAAJAAAAAQABAAIAAAAKAAAAAQABAAIAAAALAAAAAQABAAIAAAAMAAAAAQABAAIAAAANAAAAAQABAAIAAAAOAAAAAQABAAMAAAAPAAAAAQACAAMAAAAPAAEAAQACAAQAAAAPAAIAAQACAAQAAAABAAUAAQABAAAAAAACAAUAAQABAAAAAAADAAUAAQABAAAAAAAEAAUAAQABAAAAAAAFAAUAAQABAAAAAAAIAAUAAQABAAAAAAAJAAUAAQABAAAAAAAKAAUAAQABAAAAAAALAAUAAQABAAAAAAAMAAUAAQABAAAAAAANAAUAAQABAAAAAAAOAAUAAQABAAAAAAAAAAUAAQAAAAUAAAAPAAUAAQACAAUAAAAGAAUAAQAEAAQAAAAHAAUAAQAEAAQAAAA=") tile_set = ExtResource("1_rn2om") + +[node name="PointLight2D" type="PointLight2D" parent="."] +visible = false +position = Vector2(256.5, 94) +scale = Vector2(15.9688, 5.9375) +texture = ExtResource("3_m3aye") diff --git a/prefab/roomTemplates/dungeon/initialRoom.tscn b/prefab/roomTemplates/dungeon/initialRoom.tscn index 5683f83..80f05f9 100644 --- a/prefab/roomTemplates/dungeon/initialRoom.tscn +++ b/prefab/roomTemplates/dungeon/initialRoom.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=7 format=4 uid="uid://du5ldsp613fei"] +[gd_scene load_steps=8 format=4 uid="uid://du5ldsp613fei"] [ext_resource type="TileSet" uid="uid://c4wpp12rr44hi" path="res://tileSets/dungeon.tres" id="1_rn2om"] [ext_resource type="Script" path="res://scripts/map/PlayerSpawn.cs" id="2_6p8mv"] [ext_resource type="Script" path="res://scripts/map/ItemSpawn.cs" id="3_v1tlc"] +[ext_resource type="Texture2D" uid="uid://drw45jlmfo0su" path="res://sprites/light/White_100.png" id="5_4pssd"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_kiih8"] -size = Vector2(450, 191) +size = Vector2(507, 251) [sub_resource type="RectangleShape2D" id="RectangleShape2D_jxmys"] size = Vector2(18, 57.75) @@ -21,7 +22,7 @@ source_geometry_group_name = &"navigation_polygon_source_group" [node name="RoomArea" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="RoomArea"] -position = Vector2(253, 130.5) +position = Vector2(254.5, 129.5) shape = SubResource("RectangleShape2D_kiih8") [node name="RoomSlotList" type="Node2D" parent="."] @@ -63,3 +64,9 @@ tile_set = ExtResource("1_rn2om") use_parent_material = true tile_map_data = PackedByteArray("AAAAAAAAAQAAAAMAAAAAAAEAAQACAAEAAAAAAAIAAQACAAEAAAAAAAMAAQACAAEAAAAAAAQAAQACAAEAAAAAAAcAAQAAAAUAAAAPAAAAAQACAAMAAAAPAAEAAQACAAQAAAAPAAIAAQACAAQAAAAPAAMAAQACAAQAAAAPAAQAAQACAAQAAAAPAAcAAQACAAUAAAAAAAUAAQACAAEAAAAAAAYAAQACAAEAAAABAAAAAQABAAIAAAACAAAAAQABAAIAAAADAAAAAQABAAIAAAAEAAAAAQABAAIAAAAFAAAAAQABAAIAAAAGAAAAAQABAAIAAAAHAAAAAQABAAIAAAAIAAAAAQABAAIAAAAJAAAAAQABAAIAAAAKAAAAAQABAAIAAAALAAAAAQABAAIAAAAMAAAAAQABAAIAAAANAAAAAQABAAIAAAAOAAAAAQABAAMAAAABAAcAAQABAAAAAAACAAcAAQABAAAAAAADAAcAAQABAAAAAAAEAAcAAQABAAAAAAAFAAcAAQABAAAAAAAGAAcAAQABAAAAAAAHAAcAAQABAAAAAAAIAAcAAQABAAAAAAAJAAcAAQABAAAAAAAKAAcAAQABAAAAAAALAAcAAQABAAAAAAAMAAcAAQABAAAAAAANAAcAAQABAAAAAAAOAAcAAQABAAAAAAA=") tile_set = ExtResource("1_rn2om") + +[node name="PointLight2D" type="PointLight2D" parent="."] +visible = false +position = Vector2(259.5, 128.5) +scale = Vector2(16.0312, 7.96875) +texture = ExtResource("5_4pssd") diff --git a/prefab/roomTemplates/dungeon/utilityRoom.tscn b/prefab/roomTemplates/dungeon/utilityRoom.tscn index 79f37fa..4b390e9 100644 --- a/prefab/roomTemplates/dungeon/utilityRoom.tscn +++ b/prefab/roomTemplates/dungeon/utilityRoom.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=4 uid="uid://c57cc1tyreybb"] +[gd_scene load_steps=8 format=4 uid="uid://c57cc1tyreybb"] [ext_resource type="TileSet" uid="uid://c4wpp12rr44hi" path="res://tileSets/dungeon.tres" id="1_rn2om"] +[ext_resource type="Texture2D" uid="uid://drw45jlmfo0su" path="res://sprites/light/White_100.png" id="2_1ctsj"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_kiih8"] -size = Vector2(664, 435) +size = Vector2(728, 509) [sub_resource type="RectangleShape2D" id="RectangleShape2D_o85u0"] size = Vector2(20, 48) @@ -26,7 +27,7 @@ source_geometry_group_name = &"navigation_polygon_source_group" collision_mask = 0 [node name="CollisionShape2D" type="CollisionShape2D" parent="RoomArea"] -position = Vector2(370, 259.5) +position = Vector2(365, 255.5) shape = SubResource("RectangleShape2D_kiih8") [node name="RoomSlotList" type="Node2D" parent="."] @@ -70,3 +71,9 @@ tile_set = ExtResource("1_rn2om") use_parent_material = true tile_map_data = PackedByteArray("AAAAAAAAAQAAAAMAAAAAAAEAAQACAAEAAAAAAAIAAQACAAEAAAAAAAMAAQACAAEAAAAAAAQAAQACAAEAAAAAAAUAAQACAAEAAAAAAAYAAQACAAEAAAABAAAAAQABAAIAAAACAAAAAQABAAIAAAADAAAAAQABAAIAAAAEAAAAAQABAAIAAAAFAAAAAQABAAIAAAAGAAAAAQABAAIAAAAHAAAAAQABAAIAAAAIAAAAAQABAAIAAAAJAAAAAQABAAIAAAAKAAAAAQABAAIAAAALAAAAAQABAAIAAAAMAAAAAQABAAIAAAANAAAAAQABAAIAAAAOAAAAAQABAAIAAAAPAAAAAQABAAIAAAAQAAAAAQABAAIAAAARAAAAAQABAAIAAAASAAAAAQABAAIAAAATAAAAAQABAAIAAAAUAAAAAQABAAIAAAAVAAAAAQABAAIAAAAWAAAAAQACAAMAAAAWAAMAAQAAAAEAAAAWAAQAAQAAAAEAAAAWAAUAAQAAAAEAAAAWAAYAAQAAAAEAAAAWAAcAAQAAAAEAAAAWAAgAAQAAAAEAAAAWAAkAAQAAAAEAAAAWAAoAAQAAAAEAAAAWAAsAAQAAAAEAAAAWAAwAAQAAAAEAAAAAAAcAAQACAAEAAAAAAAgAAQACAAEAAAAAAAkAAQACAAEAAAAAAAoAAQACAAEAAAAAAAsAAQACAAEAAAAAAAwAAQACAAEAAAAVAA8AAQABAAAAAAAUAA8AAQABAAAAAAATAA8AAQABAAAAAAASAA8AAQABAAAAAAARAA8AAQABAAAAAAAQAA8AAQABAAAAAAAPAA8AAQABAAAAAAAOAA8AAQABAAAAAAANAA8AAQABAAAAAAAMAA8AAQABAAAAAAALAA8AAQABAAAAAAAKAA8AAQABAAAAAAAJAA8AAQABAAAAAAAIAA8AAQABAAAAAAAHAA8AAQABAAAAAAAGAA8AAQABAAAAAAAFAA8AAQABAAAAAAAEAA8AAQABAAAAAAADAA8AAQABAAAAAAACAA8AAQABAAAAAAABAA8AAQABAAAAAAAAAA8AAQAAAAUAAAAWAA8AAQACAAUAAAASAAsAAQAEAAQAAAATAAsAAQAEAAQAAAAUAAsAAQAEAAQAAAAVAAsAAQAFAAQAAAABAAsAAQADAAQAAAACAAsAAQAEAAQAAAADAAsAAQAEAAQAAAAEAAsAAQAEAAQAAAAFAAsAAQAEAAQAAAAGAAsAAQAEAAQAAAAHAAsAAQAEAAQAAAAIAAsAAQAEAAQAAAAOAAsAAQAEAAQAAAAPAAsAAQAEAAQAAAAQAAsAAQAEAAQAAAARAAsAAQAEAAQAAAABAAoAAQAEAAMAAAAVAAoAAQAEAAMAAAACAAoAAQAEAAIAAAAUAAoAAQAEAAIAAAANAAQAAQAEAAQAAAANAAwAAQAEAAQAAAAMAA0AAQAEAAQAAAALAA4AAQAEAAQAAAAJAAsAAQAEAAQAAAAGAAoAAQAEAAQAAAAHAAkAAQAEAAQAAAAIAAgAAQAEAAQAAAAJAAcAAQAEAAQAAAAKAAcAAQAEAAQAAAALAAcAAQAEAAQAAAAMAAcAAQAEAAQAAAANAAcAAQAEAAQAAAAOAAcAAQAEAAQAAAAPAAcAAQAEAAQAAAAQAAcAAQAEAAQAAAARAAcAAQAEAAQAAAASAAcAAQAEAAQAAAATAAcAAQAEAAQAAAAUAAcAAQAEAAQAAAAVAAcAAQAEAAQAAAABAAcAAQAEAAQAAAACAAcAAQAEAAQAAAADAAcAAQAEAAQAAAAEAAcAAQAEAAQAAAAFAAcAAQAEAAQAAAALAAYAAQAEAAQAAAAMAAUAAQAEAAQAAAAPAAMAAQAEAAQAAAAQAAMAAQAEAAQAAAARAAMAAQAEAAQAAAASAAMAAQAEAAQAAAATAAMAAQAEAAQAAAAUAAMAAQAEAAQAAAAVAAMAAQAEAAQAAAABAAMAAQAEAAQAAAACAAMAAQAEAAQAAAADAAMAAQAEAAQAAAAEAAMAAQAEAAQAAAAFAAMAAQAEAAQAAAAGAAMAAQAEAAQAAAAHAAMAAQAEAAQAAAAIAAMAAQAEAAQAAAAJAAMAAQAEAAQAAAA=") tile_set = ExtResource("1_rn2om") + +[node name="PointLight2D" type="PointLight2D" parent="."] +visible = false +position = Vector2(367.5, 258) +scale = Vector2(23.0938, 16.25) +texture = ExtResource("2_1ctsj") diff --git a/project.godot b/project.godot index 97dc7fa..7874440 100644 --- a/project.godot +++ b/project.godot @@ -76,6 +76,7 @@ ui_down={ pick_up={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":69,"physical_keycode":0,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null) ] } throw={ @@ -85,7 +86,8 @@ throw={ } use_item={ "deadzone": 0.5, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(211, 16),"global_position":Vector2(215, 57),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(206, 22),"global_position":Vector2(215, 68),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null) ] } hotbar_1={ @@ -135,12 +137,14 @@ hotbar_9={ } hotbar_next={ "deadzone": 0.5, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(241, 17),"global_position":Vector2(245, 58),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(257, 22),"global_position":Vector2(266, 68),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null) ] } hotbar_previous={ "deadzone": 0.5, "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(169, 17),"global_position":Vector2(173, 58),"factor":1.0,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null) ] } @@ -150,6 +154,7 @@ locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", " [layer_names] +2d_render/layer_1="Fog" 2d_physics/layer_1="RoomArea" 2d_physics/layer_2="Floor" 2d_physics/layer_3="Player" diff --git a/scenes/game.tscn b/scenes/game.tscn index 77286a6..5bd4dbd 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -114,3 +114,6 @@ visible = false [node name="AICharacterContainer" type="Node2D" parent="."] [node name="PacksackContainer" type="Node2D" parent="."] + +[node name="CanvasModulate" type="CanvasModulate" parent="."] +color = Color(0, 0, 0, 1) diff --git a/scripts/AssetHolder.cs b/scripts/AssetHolder.cs new file mode 100644 index 0000000..b6b7fdd --- /dev/null +++ b/scripts/AssetHolder.cs @@ -0,0 +1,23 @@ +using Godot; + +namespace ColdMint.scripts; + +/// +/// AssetHolder +/// 资产持有者 +/// +public static class AssetHolder +{ + public static Texture2D? White25; + public static Texture2D? White100; + + /// + /// Loading the game's static assets + /// 加载游戏的静态资产 + /// + public static void LoadStaticAsset() + { + White25 = ResourceLoader.Load("res://sprites/light/White_25.png"); + White100 = ResourceLoader.Load("res://sprites/light/White_100.png"); + } +} \ No newline at end of file diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index a0fc58b..94c6143 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -52,6 +52,15 @@ public partial class Player : CharacterTemplate healthBarUi.MaxHp = MaxHp; healthBarUi.CurrentHp = CurrentHp; } + + //Mount the camera. + //挂载相机。 + var mainCameraPackedScene = GD.Load("res://prefab/MainCamera.tscn"); + var camera2D = NodeUtils.InstantiatePackedScene(mainCameraPackedScene); + if (camera2D != null) + { + NodeUtils.CallDeferredAddChild(this, camera2D); + } } protected override void WhenBindItemContainer(IItemContainer? itemContainer) diff --git a/scripts/loader/sceneLoader/GameSceneLoader.cs b/scripts/loader/sceneLoader/GameSceneLoader.cs index 2c0fc88..5193ba2 100644 --- a/scripts/loader/sceneLoader/GameSceneLoader.cs +++ b/scripts/loader/sceneLoader/GameSceneLoader.cs @@ -19,6 +19,7 @@ public partial class GameSceneLoader : SceneLoaderTemplate public override Task InitializeData() { + RenderingServer.SetDefaultClearColor(Color.FromHsv(0, 0, 0)); //Loading the blood bar scene //加载血条场景 var healthBarUi = GetNode("CanvasLayer/Control/VBoxContainer/HealthBarUi"); diff --git a/scripts/loader/uiLoader/SplashScreenLoader.cs b/scripts/loader/uiLoader/SplashScreenLoader.cs index 46ce1f7..cfd7384 100644 --- a/scripts/loader/uiLoader/SplashScreenLoader.cs +++ b/scripts/loader/uiLoader/SplashScreenLoader.cs @@ -82,6 +82,7 @@ public partial class SplashScreenLoader : UiLoaderTemplate //Disable all logs in the release version. //在发行版禁用所有日志。 LogCat.MinLogLevel = Config.IsDebug() ? LogCat.InfoLogLevel : LogCat.DisableAllLogLevel; + AssetHolder.LoadStaticAsset(); ContributorDataManager.RegisterAllContributorData(); DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler()); MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor()); diff --git a/scripts/map/room/Room.cs b/scripts/map/room/Room.cs index 09a21e0..c1954ae 100644 --- a/scripts/map/room/Room.cs +++ b/scripts/map/room/Room.cs @@ -23,6 +23,7 @@ public class Room private List? _tileMapLayers; private Area2D? _area2D; + private PointLight2D? _pointLight2D; private CollisionShape2D? _collisionShape2D; public string? EnterRoomEventHandlerId { get; set; } @@ -59,6 +60,14 @@ public class Room _rootNode.Name); } + if (_pointLight2D != null && GameSceneNodeHolder.Player != null && node == GameSceneNodeHolder.Player) + { + //The player enters the room, opening up their view. + //玩家进入了房间,开放视野。 + _pointLight2D.Show(); + _pointLight2D.Texture = AssetHolder.White100; + } + if (string.IsNullOrEmpty(EnterRoomEventHandlerId)) { return; @@ -68,6 +77,7 @@ public class Room enterRoomEventHandler?.OnEnterRoom(node, this); } + /// /// When a node exits the room /// 当有节点退出房间时 @@ -81,6 +91,14 @@ public class Room _rootNode.Name); } + if (_pointLight2D != null && GameSceneNodeHolder.Player != null && node == GameSceneNodeHolder.Player) + { + //The player enters the room, opening up their view. + //玩家进入了房间,开放视野。 + _pointLight2D.Show(); + _pointLight2D.Texture = AssetHolder.White25; + } + if (string.IsNullOrEmpty(ExitRoomEventHandlerId)) { return; @@ -153,6 +171,7 @@ public class Room _collisionShape2D = _area2D.GetChild(0); _roomSlots = GetRoomSlots(GetTileMapLayer(Config.TileMapLayerName.Ground), _area2D, node2D.GetNode("RoomSlotList")); + _pointLight2D = node2D.GetNodeOrNull("PointLight2D"); } public Node2D? RootNode => _rootNode; diff --git a/scripts/projectile/Projectile.cs b/scripts/projectile/Projectile.cs index 4603709..e9cfb18 100644 --- a/scripts/projectile/Projectile.cs +++ b/scripts/projectile/Projectile.cs @@ -112,7 +112,6 @@ public partial class Projectile : CharacterBody2D } _destructionTime = DateTime.Now.AddMilliseconds(_life); - SetCollisionLayerValue(Config.LayerNumber.Projectile, true); SetCollisionMaskValue(Config.LayerNumber.Wall, !_ignoreWall); SetCollisionMaskValue(Config.LayerNumber.Floor, !_ignoreWall); SetCollisionMaskValue(Config.LayerNumber.Player, true); diff --git a/sprites/light/White_100.png b/sprites/light/White_100.png new file mode 100644 index 0000000000000000000000000000000000000000..7e085ef1f6fc5248a63b609d826d7918b0b334ff GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}`kpS1ArY-_ z&lxf@FmN2+&{%)onaw|I!OU%ElYd*X163dak4enF9V|BM&ZsnjL_J;oT-G@yGywo9 C#vL30 literal 0 HcmV?d00001 diff --git a/sprites/light/White_100.png.import b/sprites/light/White_100.png.import new file mode 100644 index 0000000..22fd5ed --- /dev/null +++ b/sprites/light/White_100.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://drw45jlmfo0su" +path="res://.godot/imported/White_100.png-d319ba9988ade64ae599ad90841c52c7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/light/White_100.png" +dest_files=["res://.godot/imported/White_100.png-d319ba9988ade64ae599ad90841c52c7.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/sprites/light/White_25.png b/sprites/light/White_25.png new file mode 100644 index 0000000000000000000000000000000000000000..b824b13e8c84230514689cbc339cddac7360cf7f GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={W7>k44ofy`glX(f`XnDFghIn+o zJ!{Cwz`$|X;J}SPyAQF{tZY~|`AYidDt4d}2x!-By2J4I)W+AhKzvVEKbLh*2~7Y! CdLe@V literal 0 HcmV?d00001 diff --git a/sprites/light/White_25.png.import b/sprites/light/White_25.png.import new file mode 100644 index 0000000..b2d6752 --- /dev/null +++ b/sprites/light/White_25.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://diqf0as7rn18v" +path="res://.godot/imported/White_25.png-584d94cc8c53e39250e249a7f385cbb4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/light/White_25.png" +dest_files=["res://.godot/imported/White_25.png-584d94cc8c53e39250e249a7f385cbb4.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