diff --git a/.gitignore b/.gitignore index d004749..44f84be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,16 @@ /DungeonShooting_Godot/android /DungeonShooting_Godot/.idea -/Script_Compiler/.idea -/Script_Compiler/Script_Compiler/bin -/Script_Runtime/.idea -/Script_Runtime/Script_Runtime/bin -/Script_Runtime/Script_Runtime_Test/bin -/Script_Compiler/Script_Compiler/obj -/Script_Runtime/Script_Runtime/obj -/Script_Runtime/Script_Runtime_Test/obj -/Script_Runtime/.vs -/Script_Runtime/Script_Runtime/Backups -/Script_Runtime/Script_Runtime_Generate/bin -/Script_Runtime/Script_Runtime_Generate/obj /Script_Vscode_Plugin/node_modules +/DScript/.idea +/DScript/DScript_Compiler/obj +/DScript/DScript_Compiler/bin +/DScript/DScript_Runtime/obj +/DScript/DScript_Runtime/bin +/DScript/DScript_Runtime_Generate/obj +/DScript/DScript_Runtime_Generate/bin +/DScript/DScript_Runtime_Test/obj +/DScript/DScript_Runtime_Test/bin +/DScript/DScript_Compiler_Test/bin +/DScript/DScript_Compiler_Test/obj +/DScript/DScript_Runtime/Backups +/DScript/DScript.sln.DotSettings.user \ No newline at end of file diff --git a/DungeonShooting_Godot/prefab/role/Player.tscn b/DungeonShooting_Godot/prefab/role/Player.tscn new file mode 100644 index 0000000..25ff66f --- /dev/null +++ b/DungeonShooting_Godot/prefab/role/Player.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://prefab/role/Role.tscn" type="PackedScene" id=1] +[ext_resource path="res://resource/materlal/Shadow.gdshader" type="Shader" id=2] + +[sub_resource type="ShaderMaterial" id=1] +resource_local_to_scene = true +shader = ExtResource( 2 ) +shader_param/shadowColor = Color( 0, 0, 0, 0.8 ) +shader_param/schedule = 1.0 + +[node name="Player" instance=ExtResource( 1 )] +CollisionLayer = 8 + +[node name="ShadowSprite" parent="." index="0"] +material = SubResource( 1 ) + +[node name="AnimatedSprite" parent="." index="2"] +frame = 3 diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn index df672e5..45897d9 100644 --- a/DungeonShooting_Godot/prefab/role/Role.tscn +++ b/DungeonShooting_Godot/prefab/role/Role.tscn @@ -91,7 +91,6 @@ position = Vector2( 0, -12 ) frames = SubResource( 6 ) animation = "idle" -frame = 2 playing = true [node name="Collision" type="CollisionShape2D" parent="."] diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn index 51eaeb8..502e3f3 100644 --- a/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn +++ b/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn @@ -3,7 +3,6 @@ [ext_resource path="res://src/game/item/weapon/bullet/HighSpeedBullet.cs" type="Script" id=1] [ext_resource path="res://prefab/effect/Hit.tscn" type="PackedScene" id=2] - [sub_resource type="Curve" id=1] _data = [ Vector2( 0, 0.781588 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ] diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn index 11c59c4..77b0341 100644 --- a/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn +++ b/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn @@ -4,7 +4,6 @@ [ext_resource path="res://resource/sprite/bullet/bullet.png" type="Texture" id=2] [ext_resource path="res://prefab/effect/Hit.tscn" type="PackedScene" id=3] - [node name="OrdinaryBullets" type="Node2D"] script = ExtResource( 1 ) Hit = ExtResource( 3 ) diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot index aae89d2..0a106f2 100644 --- a/DungeonShooting_Godot/project.godot +++ b/DungeonShooting_Godot/project.godot @@ -11,7 +11,7 @@ [application] config/name="DungeonShooting" -run/main_scene="res://scene/Main.tscn" +run/main_scene="res://scene/Room.tscn" config/icon="res://icon.png" [autoload] @@ -171,6 +171,10 @@ 2d_physics/layer_4="player" 2d_physics/layer_5="enemy" +[mono] + +project/assembly_name="DungeonShooting" + [physics] common/enable_pause_aware_picking=true diff --git a/DungeonShooting_Godot/scene/Room.tscn b/DungeonShooting_Godot/scene/Room.tscn index bcef96d..caddf6c 100644 --- a/DungeonShooting_Godot/scene/Room.tscn +++ b/DungeonShooting_Godot/scene/Room.tscn @@ -20,11 +20,12 @@ [node name="dungeon_test" parent="MapRoot" instance=ExtResource( 2 )] [node name="Camera2D" type="Camera2D" parent="."] -position = Vector2( 196, 128 ) +position = Vector2( 253, 219 ) current = true process_mode = 0 smoothing_enabled = true smoothing_speed = 8.0 +editor_draw_drag_margin = true script = ExtResource( 5 ) [node name="ObjectRoot" type="Node2D" parent="."] diff --git a/DungeonShooting_Godot/src/game/role/Player.cs b/DungeonShooting_Godot/src/game/role/Player.cs index 9402cbf..5894638 100644 --- a/DungeonShooting_Godot/src/game/role/Player.cs +++ b/DungeonShooting_Godot/src/game/role/Player.cs @@ -49,6 +49,10 @@ [Export] public PackedScene GunPrefab; + public Player(): base("res://prefab/role/Player.tscn") + { + } + public override void _EnterTree() { base._EnterTree(); @@ -58,6 +62,14 @@ public override void _Ready() { base._Ready(); + + //让相机跟随玩家 + var remoteTransform = new RemoteTransform2D(); + AddChild(remoteTransform); + MainCamera.Main.GlobalPosition = GlobalPosition; + MainCamera.Main.ResetSmoothing(); + remoteTransform.RemotePath = remoteTransform.GetPathTo(MainCamera.Main); + Holster.SlotList[2].Enable = true; Holster.SlotList[3].Enable = true; RefreshGunTexture(); diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index 577a7d6..b0bdf54 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -41,6 +41,11 @@ public Position2D BackMountPoint { get; private set; } /// + /// 互动碰撞区域 + /// + public Area2D InteractiveArea { get; private set; } + + /// /// 脸的朝向 /// public FaceDirection Face { get => _face; set => SetFace(value); } @@ -117,6 +122,10 @@ { } + public Role(string scenePath) : base(scenePath) + { + } + public override void _Ready() { base._Ready(); @@ -133,6 +142,11 @@ Holster = new Holster(this); Face = FaceDirection.Right; + + //连接互动物体信号 + InteractiveArea = GetNode("InteractiveArea"); + InteractiveArea.Connect("area_entered", this, nameof(_OnPropsEnter)); + InteractiveArea.Connect("area_exited", this, nameof(_OnPropsExit)); } public override void _Process(float delta)