diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn index 0f97dd9..7b06e6f 100644 --- a/DungeonShooting_Godot/prefab/role/Role.tscn +++ b/DungeonShooting_Godot/prefab/role/Role.tscn @@ -91,7 +91,7 @@ position = Vector2( 0, -12 ) frames = SubResource( 6 ) animation = "idle" -frame = 1 +frame = 3 playing = true [node name="Collision" type="CollisionShape2D" parent="."] diff --git a/DungeonShooting_Godot/scene/EditorDemo.tscn b/DungeonShooting_Godot/scene/EditorDemo.tscn new file mode 100644 index 0000000..50a1927 --- /dev/null +++ b/DungeonShooting_Godot/scene/EditorDemo.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://editor/prefabs/Editor.tscn" type="PackedScene" id=1] + +[node name="EditorDemo" type="Node2D"] + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Editor" parent="CanvasLayer" instance=ExtResource( 1 )] diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index 2fdc7dd..e4ae9a9 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -1,9 +1,20 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://editor/prefabs/Editor.tscn" type="PackedScene" id=1] +[ext_resource path="res://scene/Room.tscn" type="PackedScene" id=1] [node name="Main" type="Node2D"] [node name="CanvasLayer" type="CanvasLayer" parent="."] -[node name="Editor" parent="CanvasLayer" instance=ExtResource( 1 )] +[node name="ViewportContainer" type="ViewportContainer" parent="CanvasLayer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +stretch = true + +[node name="Viewport" type="Viewport" parent="CanvasLayer/ViewportContainer"] +size = Vector2( 480, 270 ) +transparent_bg = true +handle_input_locally = false +render_target_update_mode = 3 + +[node name="Room" parent="CanvasLayer/ViewportContainer/Viewport" instance=ExtResource( 1 )] diff --git a/DungeonShooting_Godot/src/game/role/Player.cs b/DungeonShooting_Godot/src/game/role/Player.cs index 5215b85..e817f1c 100644 --- a/DungeonShooting_Godot/src/game/role/Player.cs +++ b/DungeonShooting_Godot/src/game/role/Player.cs @@ -88,11 +88,12 @@ //枪口跟随鼠标 MountPoint.LookAt(mousePos); //脸的朝向 - if (mousePos.x > GlobalPosition.x && Face == FaceDirection.Left) + var gPos = GlobalPosition; + if (mousePos.x > gPos.x && Face == FaceDirection.Left) { Face = FaceDirection.Right; } - else if (mousePos.x < GlobalPosition.x && Face == FaceDirection.Right) + else if (mousePos.x < gPos.x && Face == FaceDirection.Right) { Face = FaceDirection.Left; } @@ -128,7 +129,7 @@ if (Holster.ActiveWeapon != null && Holster.ActiveWeapon.Reloading) { - RoomUI.Current.ReloadBar.ShowBar(GlobalPosition, 1 - Holster.ActiveWeapon.ReloadProgress); + RoomUI.Current.ReloadBar.ShowBar(gPos, 1 - Holster.ActiveWeapon.ReloadProgress); } else { diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index cc52d87..cfe9a53 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -106,7 +106,10 @@ /// 当可互动的物体改变时调用, result 参数为 null 表示变为不可互动 /// /// 检测是否可互动时的返回值 - protected abstract void ChangeInteractiveItem(CheckInteractiveResult result); + protected virtual void ChangeInteractiveItem(CheckInteractiveResult result) + { + + } public override CheckInteractiveResult CheckInteractive(ActivityObject master) { diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs index d0a656c..cb27b0c 100644 --- a/DungeonShooting_Godot/src/game/room/RoomManager.cs +++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs @@ -22,7 +22,7 @@ public override void _EnterTree() { Current = this; - Input.MouseMode = Input.MouseModeEnum.Hidden; + //Input.MouseMode = Input.MouseModeEnum.Hidden; UI = GetNode("UI"); diff --git a/DungeonShooting_Godot/src/game/ui/RoomUI.cs b/DungeonShooting_Godot/src/game/ui/RoomUI.cs index 42a57e3..23482dd 100644 --- a/DungeonShooting_Godot/src/game/ui/RoomUI.cs +++ b/DungeonShooting_Godot/src/game/ui/RoomUI.cs @@ -64,7 +64,7 @@ //将 GlobalNode 节点下的 ui 节点放入全局坐标中 var tempNode = GetNode("GlobalNode"); - var root = GetTree().CurrentScene; + var root = RoomManager.Current; var count = tempNode.GetChildCount(); for (int i = count - 1; i >= 0; i--) {