diff --git a/DungeonShooting_Godot/prefab/role/Player.tscn b/DungeonShooting_Godot/prefab/role/Player.tscn
index abab257..9089f4d 100644
--- a/DungeonShooting_Godot/prefab/role/Player.tscn
+++ b/DungeonShooting_Godot/prefab/role/Player.tscn
@@ -8,3 +8,6 @@
collision_layer = 8
script = ExtResource( 2 )
GunPrefab = ExtResource( 4 )
+
+[node name="AnimatedSprite" parent="." index="0"]
+frame = 1
diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn
index cfaf82e..a3c93fe 100644
--- a/DungeonShooting_Godot/prefab/role/Role.tscn
+++ b/DungeonShooting_Godot/prefab/role/Role.tscn
@@ -20,22 +20,6 @@
atlas = ExtResource( 3 )
region = Rect2( 48, 24, 16, 24 )
-[sub_resource type="AtlasTexture" id=21]
-atlas = ExtResource( 3 )
-region = Rect2( 0, 48, 16, 24 )
-
-[sub_resource type="AtlasTexture" id=22]
-atlas = ExtResource( 3 )
-region = Rect2( 16, 48, 16, 24 )
-
-[sub_resource type="AtlasTexture" id=23]
-atlas = ExtResource( 3 )
-region = Rect2( 32, 48, 16, 24 )
-
-[sub_resource type="AtlasTexture" id=24]
-atlas = ExtResource( 3 )
-region = Rect2( 48, 48, 16, 24 )
-
[sub_resource type="AtlasTexture" id=25]
atlas = ExtResource( 3 )
region = Rect2( 48, 48, 16, 24 )
@@ -52,6 +36,22 @@
atlas = ExtResource( 3 )
region = Rect2( 0, 48, 16, 24 )
+[sub_resource type="AtlasTexture" id=21]
+atlas = ExtResource( 3 )
+region = Rect2( 0, 48, 16, 24 )
+
+[sub_resource type="AtlasTexture" id=22]
+atlas = ExtResource( 3 )
+region = Rect2( 16, 48, 16, 24 )
+
+[sub_resource type="AtlasTexture" id=23]
+atlas = ExtResource( 3 )
+region = Rect2( 32, 48, 16, 24 )
+
+[sub_resource type="AtlasTexture" id=24]
+atlas = ExtResource( 3 )
+region = Rect2( 48, 48, 16, 24 )
+
[sub_resource type="SpriteFrames" id=6]
animations = [ {
"frames": [ SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ],
@@ -59,42 +59,41 @@
"name": "idle",
"speed": 7.0
}, {
-"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
-"loop": true,
-"name": "run",
-"speed": 10.0
-}, {
"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ],
"loop": true,
"name": "reverseRun",
"speed": 10.0
+}, {
+"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
+"loop": true,
+"name": "run",
+"speed": 10.0
} ]
-[sub_resource type="RectangleShape2D" id=29]
-extents = Vector2( 5, 7.5 )
-
[sub_resource type="RectangleShape2D" id=16]
extents = Vector2( 5, 4.5 )
+[sub_resource type="RectangleShape2D" id=29]
+extents = Vector2( 5, 7.5 )
+
[node name="Role" type="KinematicBody2D"]
collision_layer = 0
script = ExtResource( 1 )
Texture = ExtResource( 2 )
+[node name="BackMountPoint" type="Position2D" parent="."]
+position = Vector2( 0, -10 )
+
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 0, -12 )
frames = SubResource( 6 )
animation = "idle"
-frame = 2
playing = true
-[node name="HitArea" type="Area2D" parent="."]
+[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="HitArea"]
-visible = false
-position = Vector2( 0, -7.5 )
-shape = SubResource( 29 )
+position = Vector2( 0, -4.5 )
+shape = SubResource( 16 )
[node name="InteractiveArea" type="Area2D" parent="."]
collision_layer = 0
@@ -105,18 +104,16 @@
position = Vector2( 0, -4.5 )
shape = SubResource( 16 )
-[node name="Collision" type="CollisionShape2D" parent="."]
+[node name="HitArea" type="Area2D" parent="."]
visible = false
-position = Vector2( 0, -4.5 )
-shape = SubResource( 16 )
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="HitArea"]
+visible = false
+position = Vector2( 0, -7.5 )
+shape = SubResource( 29 )
[node name="MountPoint" type="Position2D" parent="."]
position = Vector2( 2, -4 )
-z_index = 1
-
-[node name="BackMountPoint" type="Position2D" parent="."]
-position = Vector2( 0, -10 )
-z_index = -1
[connection signal="area_entered" from="InteractiveArea" to="." method="_OnPropsEnter"]
[connection signal="area_exited" from="InteractiveArea" to="." method="_OnPropsExit"]
diff --git a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn
index a46592c..41e8267 100644
--- a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn
+++ b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=14 format=2]
+[gd_scene load_steps=15 format=2]
[ext_resource path="res://src/ui/RoomUI.cs" type="Script" id=1]
[ext_resource path="res://resource/sprite/ui/mapBar.png" type="Texture" id=2]
@@ -14,6 +14,9 @@
[ext_resource path="res://src/ui/InteractiveTipBar.cs" type="Script" id=12]
[ext_resource path="res://resource/sprite/ui/font_bg.png" type="Texture" id=13]
+[sub_resource type="Gradient" id=1]
+colors = PoolColorArray( 0.4, 0.498039, 1, 1, 0.4, 0.498039, 1, 0.313726 )
+
[node name="RoomUI" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@@ -137,3 +140,4 @@
[node name="Line2D" type="Line2D" parent="GlobalNode/InteractiveTipBar"]
points = PoolVector2Array( 0, -17, 0, 0 )
width = 1.0
+gradient = SubResource( 1 )
diff --git a/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png
new file mode 100644
index 0000000..617b0ae
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png.import b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png.import
new file mode 100644
index 0000000..754a705
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_pickup.png.import
@@ -0,0 +1,35 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/icon_pickup.png-87270fcf0757cfa3230028f25ad3ee19.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/ui/icon/icon_pickup.png"
+dest_files=[ "res://.import/icon_pickup.png-87270fcf0757cfa3230028f25ad3ee19.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=false
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=false
+svg/scale=1.0
diff --git a/DungeonShooting_Godot/resource/sprite/ui/icon/icon_replace.png b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_replace.png
index e956271..640b4be 100644
--- a/DungeonShooting_Godot/resource/sprite/ui/icon/icon_replace.png
+++ b/DungeonShooting_Godot/resource/sprite/ui/icon/icon_replace.png
Binary files differ
diff --git a/DungeonShooting_Godot/src/props/IProp.cs b/DungeonShooting_Godot/src/props/IProp.cs
index 960dba7..f17b5f4 100644
--- a/DungeonShooting_Godot/src/props/IProp.cs
+++ b/DungeonShooting_Godot/src/props/IProp.cs
@@ -8,7 +8,7 @@
///
/// 获取道具所在的坐标
///
- Vector2 GlobalPosition { get; }
+ Vector2 GetItemPosition();
///
/// 返回是否能互动
diff --git a/DungeonShooting_Godot/src/role/Player.cs b/DungeonShooting_Godot/src/role/Player.cs
index a958225..4ccf0e4 100644
--- a/DungeonShooting_Godot/src/role/Player.cs
+++ b/DungeonShooting_Godot/src/role/Player.cs
@@ -146,7 +146,7 @@
if (InteractiveItem is Gun gun)
{
//显示互动提示
- RoomUI.Current.InteractiveTipBar.ShowBar(result.Target.GlobalPosition, result.ShowIcon, result.Message);
+ RoomUI.Current.InteractiveTipBar.ShowBar(result.Target.GetItemPosition(), result.ShowIcon, result.Message);
}
}
}
diff --git a/DungeonShooting_Godot/src/role/Role.cs b/DungeonShooting_Godot/src/role/Role.cs
index 2b6675b..9674d66 100644
--- a/DungeonShooting_Godot/src/role/Role.cs
+++ b/DungeonShooting_Godot/src/role/Role.cs
@@ -173,7 +173,11 @@
/// 武器对象
public void PickUpGun(Gun gun)
{
- Holster.PickupGun(gun);
+ if (Holster.PickupGun(gun) != -1)
+ {
+ //从可互动队列中移除
+ InteractiveItemList.Remove(gun);
+ }
}
///
diff --git a/DungeonShooting_Godot/src/ui/InteractiveTipBar.cs b/DungeonShooting_Godot/src/ui/InteractiveTipBar.cs
index 188b05e..287ebcb 100644
--- a/DungeonShooting_Godot/src/ui/InteractiveTipBar.cs
+++ b/DungeonShooting_Godot/src/ui/InteractiveTipBar.cs
@@ -14,11 +14,20 @@
Bg = GetNode("Bg");
}
+ ///
+ /// 隐藏互动提示ui
+ ///
public void HideBar()
{
Visible = false;
}
+ ///
+ /// 显示互动提示ui
+ ///
+ /// 所在坐标
+ /// 显示图标
+ /// 显示文本
public void ShowBar(Vector2 pos, string icon, string message)
{
GlobalPosition = pos;
diff --git a/DungeonShooting_Godot/src/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/weapon/gun/Gun.cs
index 461764a..cbedc9a 100644
--- a/DungeonShooting_Godot/src/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/weapon/gun/Gun.cs
@@ -516,15 +516,15 @@
}
else //没有武器
{
- if (masterGun != null && masterGun.Attribute.WeightType == Attribute.WeightType) //替换武器
+ if (master.Holster.CanPickupGun(this)) //能拾起武器
{
- //可以互动, 切换武器
+ //可以互动, 拾起武器
result.CanInteractive = true;
result.Message = Attribute.Name;
- result.ShowIcon = "res://resource/sprite/ui/icon/icon_replace.png";
+ result.ShowIcon = "res://resource/sprite/ui/icon/icon_pickup.png";
return result;
}
- else if (master.Holster.CanPickupGun(this)) //能拾起武器
+ else if (masterGun != null && masterGun.Attribute.WeightType == Attribute.WeightType) //替换武器
{
//可以互动, 切换武器
result.CanInteractive = true;
@@ -592,6 +592,11 @@
}
}
+ public Vector2 GetItemPosition()
+ {
+ return GlobalPosition;
+ }
+
///
/// 触发落到地面
///