为物体添加是否可互动接口
This commit is contained in:
parent
cd7b711593
commit
3713748736
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/DungeonShooting_Godot/android
|
Binary file not shown.
After Width: | Height: | Size: 175 B |
|
@ -74,7 +74,7 @@ custom_features=""
|
|||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
export_path="../../export/test.apk"
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
|
@ -82,8 +82,10 @@ script_encryption_key=""
|
|||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
custom_template/use_custom_build=false
|
||||
custom_template/export_format=0
|
||||
custom_build/use_custom_build=true
|
||||
custom_build/export_format=0
|
||||
custom_build/min_sdk=""
|
||||
custom_build/target_sdk=""
|
||||
architectures/armeabi-v7a=true
|
||||
architectures/arm64-v8a=true
|
||||
architectures/x86=false
|
||||
|
@ -97,8 +99,6 @@ keystore/release_password=""
|
|||
one_click_deploy/clear_previous_install=false
|
||||
version/code=1
|
||||
version/name="1.0"
|
||||
version/min_sdk=19
|
||||
version/target_sdk=30
|
||||
package/unique_name="org.godotengine.$genname"
|
||||
package/name=""
|
||||
package/signed=true
|
||||
|
@ -196,6 +196,7 @@ permissions/location_hardware=false
|
|||
permissions/manage_accounts=false
|
||||
permissions/manage_app_tokens=false
|
||||
permissions/manage_documents=false
|
||||
permissions/manage_external_storage=false
|
||||
permissions/master_clear=false
|
||||
permissions/media_content_control=false
|
||||
permissions/modify_audio_settings=false
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
[ext_resource path="res://src/effect/Cursor.cs" type="Script" id=2]
|
||||
|
||||
[node name="Cursor" type="Node2D"]
|
||||
z_index = 15
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="LT" type="Sprite" parent="."]
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=9 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]
|
||||
[ext_resource path="res://resource/sprite/ui/RoomUi.png" type="Texture" id=3]
|
||||
[ext_resource path="res://resource/sprite/ui/healthBar.png" type="Texture" id=4]
|
||||
[ext_resource path="res://resource/sprite/gun/gun4.png" type="Texture" id=5]
|
||||
[ext_resource path="res://resource/sprite/ui/hpBar.png" type="Texture" id=6]
|
||||
|
@ -15,11 +14,6 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="RoomUi" type="Sprite" parent="."]
|
||||
visible = false
|
||||
texture = ExtResource( 3 )
|
||||
centered = false
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
|
BIN
DungeonShooting_Godot/resource/sprite/ui/keyboard/e.png
Normal file
BIN
DungeonShooting_Godot/resource/sprite/ui/keyboard/e.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 B |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/e.png-d1dbc742a6aa925ce067b6aa2ad41342.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resource/sprite/ui/keyboard/e.png"
|
||||
dest_files=[ "res://.import/e.png-d1dbc742a6aa925ce067b6aa2ad41342.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
|
|
@ -59,6 +59,7 @@ z_index = -3
|
|||
[node name="TileMap" type="TileMap" parent="Position2D/Navigation2D/Node2D"]
|
||||
tile_set = SubResource( 3 )
|
||||
cell_size = Vector2( 16, 16 )
|
||||
bake_navigation = true
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 131074, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327699, 0, 0, 327700, 0, 0, 327701, 0, 0, 327702, 0, 0, 327703, 0, 0, 327704, 0, 0, 327705, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 393225, 0, 0, 393226, 0, 0, 393227, 0, 0, 393228, 0, 0, 393229, 0, 0, 393235, 0, 0, 393236, 0, 0, 393237, 0, 0, 393238, 0, 0, 393239, 0, 0, 393240, 0, 0, 393241, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 458765, 0, 0, 458771, 0, 0, 458772, 0, 0, 458773, 0, 0, 458774, 0, 0, 458775, 0, 0, 458776, 0, 0, 458777, 0, 0, 524299, 0, 0, 524300, 0, 0, 524301, 0, 0, 524307, 0, 0, 524308, 0, 0, 524309, 0, 0, 524310, 0, 0, 524311, 0, 0, 524312, 0, 0, 524313, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589843, 0, 0, 589844, 0, 0, 589845, 0, 0, 589846, 0, 0, 589847, 0, 0, 589848, 0, 0, 589849, 0, 0, 589850, 0, 0, 589851, 0, 0, 655371, 0, 0, 655372, 0, 0, 655373, 0, 0, 655379, 0, 0, 655380, 0, 0, 655381, 0, 0, 655382, 0, 0, 655383, 0, 0, 655384, 0, 0, 655385, 0, 0, 655386, 0, 0, 655387, 0, 0, 720897, 0, 0, 720898, 0, 0, 720899, 0, 0, 720900, 0, 0, 720901, 0, 0, 720902, 0, 0, 720903, 0, 0, 720904, 0, 0, 720905, 0, 0, 720906, 0, 0, 720907, 0, 0, 720908, 0, 0, 720909, 0, 0, 720915, 0, 0, 720916, 0, 0, 720917, 0, 0, 720918, 0, 0, 720919, 0, 0, 720920, 0, 0, 720921, 0, 0, 720922, 0, 0, 720923, 0, 0, 786433, 0, 0, 786434, 0, 0, 786435, 0, 0, 786436, 0, 0, 786437, 0, 0, 786438, 0, 0, 786439, 0, 0, 786440, 0, 0, 786441, 0, 0, 786442, 0, 0, 786443, 0, 0, 786444, 0, 0, 786445, 0, 0, 786446, 0, 0, 786447, 0, 0, 786448, 0, 0, 786449, 0, 0, 786450, 0, 0, 786451, 0, 0, 786452, 0, 0, 786453, 0, 0, 786454, 0, 0, 786455, 0, 0, 786456, 0, 0, 786457, 0, 0, 786458, 0, 0, 786459, 0, 0, 851979, 0, 0, 851980, 0, 0, 851981, 0, 0, 851982, 0, 0, 851983, 0, 0, 851984, 0, 0, 851985, 0, 0, 851986, 0, 0, 851987, 0, 0, 851988, 0, 0, 851989, 0, 0, 851990, 0, 0, 851991, 0, 0, 851992, 0, 0, 851993, 0, 0, 851994, 0, 0, 851995, 0, 0, 917515, 0, 0, 917516, 0, 0, 917517, 0, 0, 917518, 0, 0, 917519, 0, 0, 917520, 0, 0, 917521, 0, 0, 917522, 0, 0, 917523, 0, 0, 917524, 0, 0, 917525, 0, 0, 917526, 0, 0, 917527, 0, 0, 917528, 0, 0, 917529, 0, 0, 917530, 0, 0, 917531, 0, 0, 983051, 0, 0, 983052, 0, 0, 983053, 0, 0, 983054, 0, 0, 983055, 0, 0, 983056, 0, 0, 983057, 0, 0, 983058, 0, 0, 983059, 0, 0, 983060, 0, 0, 983061, 0, 0, 983062, 0, 0, 983063, 0, 0, 983064, 0, 0, 983065, 0, 0, 983066, 0, 0, 983067, 0, 0 )
|
||||
|
||||
|
@ -67,6 +68,7 @@ tile_data = PoolIntArray( 131074, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0
|
|||
[node name="TileMap" type="TileMap" parent="Position2D/Navigation2D/Node2D2"]
|
||||
tile_set = SubResource( 5 )
|
||||
cell_size = Vector2( 16, 16 )
|
||||
bake_navigation = true
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 131088, 0, 0, 131089, 0, 0, 131090, 0, 0, 131091, 0, 0, 131092, 0, 0, 196622, 0, 0, 196623, 0, 0, 196624, 0, 0, 196628, 0, 0, 262156, 0, 0, 262157, 0, 0, 262158, 0, 0, 262164, 0, 0, 327692, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 589842, 0, 0 )
|
||||
|
||||
|
|
|
@ -112,22 +112,28 @@ public class ThrowNode : KinematicBody2D
|
|||
if (mount != null)
|
||||
{
|
||||
Mount = mount;
|
||||
var parent = mount.GetParent();
|
||||
if (parent == null)
|
||||
var mountParent = mount.GetParent();
|
||||
if (mountParent == null)
|
||||
{
|
||||
AddChild(mount);
|
||||
}
|
||||
else if (parent != this)
|
||||
else if (mountParent != this)
|
||||
{
|
||||
parent.RemoveChild(mount);
|
||||
mountParent.RemoveChild(mount);
|
||||
AddChild(mount);
|
||||
}
|
||||
mount.Position = new Vector2(0, -startHeight);
|
||||
}
|
||||
if (GetParent() == null)
|
||||
var parent = GetParent();
|
||||
if (parent == null)
|
||||
{
|
||||
RoomManager.Current.SortRoot.AddChild(this);
|
||||
}
|
||||
else if (parent == RoomManager.Current.SortRoot)
|
||||
{
|
||||
parent.RemoveChild(this);
|
||||
RoomManager.Current.SortRoot.AddChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -91,6 +91,23 @@ public class Holster
|
|||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回是否能放入武器
|
||||
/// </summary>
|
||||
/// <param name="gun">武器对象</param>
|
||||
public bool CanPickupGun(Gun gun)
|
||||
{
|
||||
for (int i = 0; i < SlotList.Length; i++)
|
||||
{
|
||||
var item = SlotList[i];
|
||||
if (item.Enable && gun.Attribute.WeightType == item.Type && item.Gun == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拾起武器, 存入枪套中, 返回存放在枪套的位置, 如果容不下这把武器, 则会返回 -1
|
||||
/// </summary>
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
/// </summary>
|
||||
public interface IProp
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回是否能互动
|
||||
/// </summary>
|
||||
/// <param name="master">触发者</param>
|
||||
bool CanTnteractive(Role master);
|
||||
|
||||
/// <summary>
|
||||
/// 与角色互动时调用
|
||||
/// </summary>
|
||||
|
|
|
@ -24,7 +24,7 @@ public class RoomManager : Node2D
|
|||
public override void _EnterTree()
|
||||
{
|
||||
Current = this;
|
||||
Input.SetMouseMode(Input.MouseMode.Hidden);
|
||||
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||
// 初始化鼠标
|
||||
Cursor = MouseCursor.Instance<Cursor>();
|
||||
AddChild(Cursor);
|
||||
|
|
|
@ -477,8 +477,30 @@ public abstract class Gun : Area2D, IProp
|
|||
}
|
||||
}
|
||||
|
||||
public bool CanTnteractive(Role master)
|
||||
{
|
||||
//查找是否有同类型武器
|
||||
var index = master.Holster.FindGun(Attribute.Id);
|
||||
if (index != -1) //如果有这个武器
|
||||
{
|
||||
if (CurrAmmo + ResidueAmmo == 0) //没有子弹了
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else //没有武器
|
||||
{
|
||||
if (!master.Holster.CanPickupGun(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Tnteractive(Role master)
|
||||
{
|
||||
//查找是否有同类型武器
|
||||
var index = master.Holster.FindGun(Attribute.Id);
|
||||
if (index != -1) //如果有这个武器
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user