解决更改架构后游戏无法正常运行的问题, 目前能正常跑起来了

This commit is contained in:
小李xl 2022-10-17 02:02:12 +08:00
parent 173e6a1d84
commit d03e84caef
9 changed files with 65 additions and 17 deletions

25
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -91,7 +91,6 @@ position = Vector2( 0, -10 )
position = Vector2( 0, -12 )
frames = SubResource( 6 )
animation = "idle"
frame = 2
playing = true
[node name="Collision" type="CollisionShape2D" parent="."]

View File

@ -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 ]

View File

@ -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 )

View File

@ -11,7 +11,7 @@ config_version=4
[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 @@ reload={
2d_physics/layer_4="player"
2d_physics/layer_5="enemy"
[mono]
project/assembly_name="DungeonShooting"
[physics]
common/enable_pause_aware_picking=true

View File

@ -20,11 +20,12 @@ z_index = -10
[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="."]

View File

@ -49,6 +49,10 @@ public class Player : Role
[Export] public PackedScene GunPrefab;
public Player(): base("res://prefab/role/Player.tscn")
{
}
public override void _EnterTree()
{
base._EnterTree();
@ -58,6 +62,14 @@ public class Player : Role
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();

View File

@ -40,6 +40,11 @@ public abstract class Role : ActivityObject
/// </summary>
public Position2D BackMountPoint { get; private set; }
/// <summary>
/// 互动碰撞区域
/// </summary>
public Area2D InteractiveArea { get; private set; }
/// <summary>
/// 脸的朝向
/// </summary>
@ -117,6 +122,10 @@ public abstract class Role : ActivityObject
{
}
public Role(string scenePath) : base(scenePath)
{
}
public override void _Ready()
{
base._Ready();
@ -133,6 +142,11 @@ public abstract class Role : ActivityObject
Holster = new Holster(this);
Face = FaceDirection.Right;
//连接互动物体信号
InteractiveArea = GetNode<Area2D>("InteractiveArea");
InteractiveArea.Connect("area_entered", this, nameof(_OnPropsEnter));
InteractiveArea.Connect("area_exited", this, nameof(_OnPropsExit));
}
public override void _Process(float delta)