Compare commits

...

2 Commits

Author SHA1 Message Date
30f37a0d9a 商店开发中 2024-03-31 02:25:50 +08:00
70af4f69e6 商店开发中 2024-03-30 13:42:58 +08:00
26 changed files with 518 additions and 320 deletions

View File

@ -49,6 +49,10 @@ public enum ActivityType
/// </summary>
Treasure,
/// <summary>
/// Npc
/// </summary>
Npc,
/// <summary>
/// 其它类型
/// </summary>
Other = 99,

View File

@ -1 +1 @@
7
8

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=13 format=3 uid="uid://b8s1dgu63fddf"]
[ext_resource type="PackedScene" uid="uid://dbrig6dq441wo" path="res://prefab/role/template/EnemyTemplate.tscn" id="1_2vqwe"]
[ext_resource type="PackedScene" uid="uid://dbrig6dq441wo" path="res://prefab/role/template/AiTemplate.tscn" id="1_2vqwe"]
[ext_resource type="Script" path="res://src/game/activity/role/enemy/Enemy.cs" id="2_0pcq3"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="3_x8agd"]
[ext_resource type="SpriteFrames" uid="uid://cnctpyrn02rhd" path="res://resource/spriteFrames/role/Enemy0001.tres" id="4_qv8w5"]
@ -9,7 +9,6 @@
[ext_resource type="Animation" uid="uid://16rxpnsgj5tl" path="res://resource/animation/enemy/Enemy_notify.res" id="6_x8gmo"]
[ext_resource type="Animation" uid="uid://cmje7jsgrhgmx" path="res://resource/animation/enemy/Enemy_query.res" id="7_e37p2"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3nkur"]
resource_local_to_scene = true
shader = ExtResource("3_x8agd")

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=13 format=3 uid="uid://daqsdld5gnwwr"]
[ext_resource type="PackedScene" uid="uid://dbrig6dq441wo" path="res://prefab/role/template/EnemyTemplate.tscn" id="1_fanet"]
[ext_resource type="PackedScene" uid="uid://dbrig6dq441wo" path="res://prefab/role/template/AiTemplate.tscn" id="1_fanet"]
[ext_resource type="Script" path="res://src/game/activity/role/enemy/NoWeaponEnemy.cs" id="2_3an4s"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_yunbp"]
[ext_resource type="SpriteFrames" uid="uid://ctpkpxgcwb583" path="res://resource/spriteFrames/role/Enemy0002.tres" id="3_hbsqi"]

View File

@ -0,0 +1,60 @@
[gd_scene load_steps=7 format=3 uid="uid://dyl1dhtlxbcb3"]
[ext_resource type="PackedScene" uid="uid://dbrig6dq441wo" path="res://prefab/role/template/AiTemplate.tscn" id="1_25fpq"]
[ext_resource type="Script" path="res://src/game/activity/role/shop/ShopBoss.cs" id="2_2ng7e"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_7m501"]
[ext_resource type="SpriteFrames" uid="uid://bxn63xs3f87jy" path="res://resource/spriteFrames/role/ShopBoss0001.tres" id="3_b0a5c"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0nvxl"]
resource_local_to_scene = true
shader = ExtResource("2_7m501")
shader_parameter/blend = Color(0, 0, 0, 0.470588)
shader_parameter/schedule = 1.0
shader_parameter/modulate = Color(1, 1, 1, 1)
shader_parameter/show_outline = true
shader_parameter/outline_color = Color(0, 0, 0, 1)
shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
shader_parameter/grey = 0.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_x86iq"]
resource_local_to_scene = true
shader = ExtResource("2_7m501")
shader_parameter/blend = Color(1, 1, 1, 1)
shader_parameter/schedule = 0.0
shader_parameter/modulate = Color(1, 1, 1, 1)
shader_parameter/show_outline = true
shader_parameter/outline_color = Color(0, 0, 0, 1)
shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
shader_parameter/grey = 0.0
[node name="ShopBoss0001" node_paths=PackedStringArray("ViewRay", "NavigationAgent2D", "NavigationPoint", "FirePoint", "HurtArea", "HurtCollision", "InteractiveArea", "InteractiveCollision", "TipRoot", "TipSprite", "AnimationPlayer", "MountPoint", "BackMountPoint", "MeleeAttackArea", "MeleeAttackCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_25fpq")]
collision_layer = 1024
script = ExtResource("2_2ng7e")
ViewRay = NodePath("ViewRay")
NavigationAgent2D = NodePath("NavigationPoint/NavigationAgent2D")
NavigationPoint = NodePath("NavigationPoint")
FirePoint = NodePath("FirePoint")
HurtArea = NodePath("HurtArea")
HurtCollision = NodePath("HurtArea/HurtCollision")
InteractiveArea = NodePath("InteractiveArea")
InteractiveCollision = NodePath("InteractiveArea/InteractiveCollision")
TipRoot = NodePath("TipRoot")
TipSprite = NodePath("TipRoot/TipSprite")
AnimationPlayer = NodePath("AnimationPlayer")
MountPoint = NodePath("MountPoint")
BackMountPoint = NodePath("BackMountPoint")
MeleeAttackArea = NodePath("MountPoint/MeleeAttackArea")
MeleeAttackCollision = NodePath("MountPoint/MeleeAttackArea/MeleeAttackCollision")
ShadowSprite = NodePath("ShadowSprite")
AnimatedSprite = NodePath("AnimatedSprite")
Collision = NodePath("Collision")
[node name="ShadowSprite" parent="." index="0"]
material = SubResource("ShaderMaterial_0nvxl")
[node name="AnimatedSprite" parent="." index="2"]
material = SubResource("ShaderMaterial_x86iq")
sprite_frames = ExtResource("3_b0a5c")
animation = &"idle"

View File

@ -1,12 +1,11 @@
[gd_scene load_steps=5 format=3 uid="uid://dbrig6dq441wo"]
[ext_resource type="PackedScene" uid="uid://cyrcv2jdgr8cf" path="res://prefab/role/template/RoleTemplate.tscn" id="1_5po38"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="3_x8agd"]
[ext_resource type="PackedScene" uid="uid://cyrcv2jdgr8cf" path="res://prefab/role/template/RoleTemplate.tscn" id="1_dbfvf"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="1_xedx7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_k8mt5"]
resource_local_to_scene = true
shader = ExtResource("3_x8agd")
shader = ExtResource("1_xedx7")
shader_parameter/blend = Color(1, 1, 1, 1)
shader_parameter/schedule = 0.0
shader_parameter/modulate = Color(1, 1, 1, 1)
@ -19,7 +18,7 @@ shader_parameter/grey = 0.0
[sub_resource type="CircleShape2D" id="CircleShape2D_wu0xv"]
radius = 8.06226
[node name="EnemyTemplate" instance=ExtResource("1_5po38")]
[node name="AiTemplate" instance=ExtResource("1_dbfvf")]
collision_layer = 16
collision_mask = 25
floor_stop_on_slope = false

View File

@ -1,13 +1,13 @@
[gd_scene load_steps=9 format=3 uid="uid://cyrcv2jdgr8cf"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="1_xk5yk"]
[ext_resource type="Script" path="res://src/game/activity/role/MountRotation.cs" id="2_5ddpw"]
[ext_resource type="Script" path="res://src/framework/activity/hurt/HurtArea.cs" id="2_8jnvr"]
[ext_resource type="SpriteFrames" uid="uid://c8h5svp76h3kw" path="res://resource/spriteFrames/role/Role_tip.tres" id="3_bo78w"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="1_xedx7"]
[ext_resource type="Script" path="res://src/framework/activity/hurt/HurtArea.cs" id="2_2eey0"]
[ext_resource type="Script" path="res://src/game/activity/role/MountRotation.cs" id="3_1jj1i"]
[ext_resource type="SpriteFrames" uid="uid://c8h5svp76h3kw" path="res://resource/spriteFrames/role/Role_tip.tres" id="4_kn7in"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yif6x"]
resource_local_to_scene = true
shader = ExtResource("1_xk5yk")
shader = ExtResource("1_xedx7")
shader_parameter/blend = Color(1, 1, 1, 1)
shader_parameter/schedule = 0.0
shader_parameter/modulate = Color(1, 1, 1, 1)
@ -49,7 +49,7 @@ shape = SubResource("CircleShape2D_5pj80")
collision_layer = 0
collision_mask = 0
monitoring = false
script = ExtResource("2_8jnvr")
script = ExtResource("2_2eey0")
[node name="HurtCollision" type="CollisionShape2D" parent="HurtArea"]
position = Vector2(0, -9)
@ -66,7 +66,7 @@ shape = SubResource("CapsuleShape2D_843d5")
[node name="MountPoint" type="Marker2D" parent="."]
position = Vector2(2, -8)
script = ExtResource("2_5ddpw")
script = ExtResource("3_1jj1i")
[node name="MeleeAttackArea" type="Area2D" parent="MountPoint"]
visible = false
@ -81,6 +81,6 @@ monitorable = false
[node name="TipSprite" type="AnimatedSprite2D" parent="TipRoot"]
visible = false
position = Vector2(0, -22)
sprite_frames = ExtResource("3_bo78w")
sprite_frames = ExtResource("4_kn7in")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@ -31,7 +31,7 @@ project/assembly_name="DungeonShooting"
[editor_plugins]
enabled=PackedStringArray()
enabled=PackedStringArray("res://addons/dungeonShooting_plugin/plugin.cfg")
[file_customization]
@ -252,6 +252,7 @@ roulette={
2d_physics/layer_8="debris"
2d_physics/layer_9="throwing"
2d_physics/layer_10="obstacle"
2d_physics/layer_11="npc"
2d_physics/layer_14="ui_mouse"
[mono]

View File

@ -23,7 +23,7 @@
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/role/Enemy0001.tscn",
"Prefab": "res://prefab/role/enemy/Enemy0001.tscn",
"Icon": "res://resource/sprite/role/enemy0001/enemy0001_Icon.png",
"ShowInMapEditor": true
},
@ -37,10 +37,24 @@
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/role/Enemy0002.tscn",
"Prefab": "res://prefab/role/enemy/Enemy0002.tscn",
"Icon": "res://resource/sprite/role/enemy0002/Enemy0002.png",
"ShowInMapEditor": true
},
{
"Id": "shopBoss0001",
"Name": "\u5546\u5E97\u8001\u677F",
"Type": 11,
"Quality": 0,
"Price": 0,
"Intro": "\u5546\u5E97\u8001\u677F",
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/role/shopBoss/ShopBoss0001.tscn",
"Icon": "res://resource/sprite/role/shopBoss0001/ShopBoss0001.png",
"ShowInMapEditor": true
},
{
"Id": "weapon0001",
"Name": "\u6B65\u67AA",

View File

@ -0,0 +1,38 @@
[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://bxn63xs3f87jy"]
[ext_resource type="Texture2D" uid="uid://cfgdtj2quumhy" path="res://resource/sprite/role/shopBoss0001/ShopBoss0001.png" id="1_k2gly"]
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_k2gly")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_k2gly")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_k2gly")
}],
"loop": true,
"name": &"reverseRun",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_k2gly")
}],
"loop": true,
"name": &"run",
"speed": 5.0
}]

View File

@ -121,7 +121,7 @@ DefaultLayer = 1
ShowOffset = Vector2(2.08165e-12, 2)
CollisionVisible = false
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0006" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0006" index="0"]
position = Vector2(-11, -3)
texture = ExtResource("7_30qwa")
@ -133,7 +133,7 @@ DefaultLayer = 1
ShowOffset = Vector2(2.08165e-12, 2)
CollisionVisible = false
[node name="ActivityInstance" type="Node2D" parent="ItemRoot/Item0008" index="1"]
[node name="ActivityInstance" type="Node2D" parent="ItemRoot/Item0008" index="0"]
position = Vector2(2.5, -12)
script = ExtResource("5_lowqi")
Id = "item_0031"
@ -149,7 +149,7 @@ DefaultLayer = 1
ShowOffset = Vector2(2.08165e-12, 2)
CollisionVisible = false
[node name="Item26" type="Sprite2D" parent="ItemRoot/Item0013" index="1"]
[node name="Item26" type="Sprite2D" parent="ItemRoot/Item0013" index="0"]
position = Vector2(18, -2)
texture = ExtResource("8_61dkg")
@ -161,19 +161,19 @@ DefaultLayer = 1
ShowOffset = Vector2(2.08165e-12, 2)
CollisionVisible = false
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0017" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0017" index="0"]
position = Vector2(-2, -13)
texture = ExtResource("8_u3vry")
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0017" index="2"]
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0017" index="1"]
position = Vector2(18, -11)
texture = ExtResource("9_lhdr8")
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0017" index="3"]
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0017" index="2"]
position = Vector2(-16, -2)
texture = ExtResource("10_4eqn0")
[node name="Sprite2D4" type="Sprite2D" parent="ItemRoot/Item0017" index="4"]
[node name="Sprite2D4" type="Sprite2D" parent="ItemRoot/Item0017" index="3"]
position = Vector2(10, -1)
texture = ExtResource("11_tg3jo")
@ -201,12 +201,12 @@ Id = "item_0002"
DefaultLayer = 1
CollisionVisible = false
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0002" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0002" index="0"]
position = Vector2(133, 114)
rotation = 1.5708
texture = ExtResource("12_agfji")
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0002" index="2"]
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0002" index="1"]
material = SubResource("ShaderMaterial_i7git")
position = Vector2(0, -18)
scale = Vector2(1, -1)
@ -227,7 +227,7 @@ ShadowZIndex = 0
VerticalMotion = false
CollisionVisible = false
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0004" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0004" index="0"]
position = Vector2(71, -37)
texture = ExtResource("13_unnpl")
@ -263,15 +263,15 @@ script = ExtResource("5_lowqi")
Id = "item_0009"
DefaultLayer = 1
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0009" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0009" index="0"]
position = Vector2(-24, -10)
texture = ExtResource("15_h7524")
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0009" index="2"]
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0009" index="1"]
position = Vector2(1, -10)
texture = ExtResource("15_h7524")
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0009" index="3"]
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0009" index="2"]
position = Vector2(37, -10)
texture = ExtResource("15_h7524")
@ -305,7 +305,7 @@ script = ExtResource("5_lowqi")
Id = "item_0015"
DefaultLayer = 1
[node name="Slice04" type="Sprite2D" parent="ItemRoot/Item0015" index="1"]
[node name="Slice04" type="Sprite2D" parent="ItemRoot/Item0015" index="0"]
position = Vector2(16, -9)
texture = ExtResource("15_h7524")
@ -328,11 +328,11 @@ script = ExtResource("5_lowqi")
Id = "item_0019"
DefaultLayer = 1
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0019" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0019" index="0"]
position = Vector2(-20, -9)
texture = ExtResource("16_xj0e1")
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0019" index="2"]
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0019" index="1"]
position = Vector2(17, -8)
texture = ExtResource("17_gwwce")

View File

@ -8,22 +8,31 @@ namespace Config;
public static partial class ExcelConfig
{
/// <summary>
/// ActivePropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// BuffPropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivePropBase> ActivePropBase_List { get; private set; }
public static List<BuffPropBase> BuffPropBase_List { get; private set; }
/// <summary>
/// ActivePropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// BuffPropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivePropBase> ActivePropBase_Map { get; private set; }
public static Dictionary<string, BuffPropBase> BuffPropBase_Map { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivityBase> ActivityBase_List { get; private set; }
public static List<Sound> Sound_List { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivityBase> ActivityBase_Map { get; private set; }
public static Dictionary<string, Sound> Sound_Map { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<WeaponBase> WeaponBase_List { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, WeaponBase> WeaponBase_Map { get; private set; }
/// <summary>
/// ActivityMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
@ -43,15 +52,6 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, AiAttackAttr> AiAttackAttr_Map { get; private set; }
/// <summary>
/// BuffPropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<BuffPropBase> BuffPropBase_List { get; private set; }
/// <summary>
/// BuffPropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, BuffPropBase> BuffPropBase_Map { get; private set; }
/// <summary>
/// BulletBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -61,6 +61,15 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, BulletBase> BulletBase_Map { get; private set; }
/// <summary>
/// ActivePropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivePropBase> ActivePropBase_List { get; private set; }
/// <summary>
/// ActivePropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivePropBase> ActivePropBase_Map { get; private set; }
/// <summary>
/// EnemyBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -70,6 +79,15 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, EnemyBase> EnemyBase_Map { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivityBase> ActivityBase_List { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivityBase> ActivityBase_Map { get; private set; }
/// <summary>
/// LiquidMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -79,24 +97,6 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, LiquidMaterial> LiquidMaterial_Map { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<Sound> Sound_List { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, Sound> Sound_Map { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<WeaponBase> WeaponBase_List { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, WeaponBase> WeaponBase_Map { get; private set; }
private static bool _init = false;
/// <summary>
@ -107,94 +107,22 @@ public static partial class ExcelConfig
if (_init) return;
_init = true;
_InitActivePropBaseConfig();
_InitActivityBaseConfig();
_InitActivityMaterialConfig();
_InitAiAttackAttrConfig();
_InitBuffPropBaseConfig();
_InitBulletBaseConfig();
_InitEnemyBaseConfig();
_InitLiquidMaterialConfig();
_InitSoundConfig();
_InitWeaponBaseConfig();
_InitActivityMaterialConfig();
_InitAiAttackAttrConfig();
_InitBulletBaseConfig();
_InitActivePropBaseConfig();
_InitEnemyBaseConfig();
_InitActivityBaseConfig();
_InitLiquidMaterialConfig();
_InitActivePropBaseRef();
_InitActivityBaseRef();
_InitBuffPropBaseRef();
_InitEnemyBaseRef();
_InitWeaponBaseRef();
}
private static void _InitActivePropBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivePropBase.json");
ActivePropBase_List = new List<ActivePropBase>(JsonSerializer.Deserialize<List<Ref_ActivePropBase>>(text));
ActivePropBase_Map = new Dictionary<string, ActivePropBase>();
foreach (var item in ActivePropBase_List)
{
ActivePropBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivePropBase'失败!");
}
}
private static void _InitActivityBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivityBase.json");
ActivityBase_List = new List<ActivityBase>(JsonSerializer.Deserialize<List<Ref_ActivityBase>>(text));
ActivityBase_Map = new Dictionary<string, ActivityBase>();
foreach (var item in ActivityBase_List)
{
ActivityBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivityBase'失败!");
}
}
private static void _InitActivityMaterialConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivityMaterial.json");
ActivityMaterial_List = JsonSerializer.Deserialize<List<ActivityMaterial>>(text);
ActivityMaterial_Map = new Dictionary<string, ActivityMaterial>();
foreach (var item in ActivityMaterial_List)
{
ActivityMaterial_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivityMaterial'失败!");
}
}
private static void _InitAiAttackAttrConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/AiAttackAttr.json");
AiAttackAttr_List = JsonSerializer.Deserialize<List<AiAttackAttr>>(text);
AiAttackAttr_Map = new Dictionary<string, AiAttackAttr>();
foreach (var item in AiAttackAttr_List)
{
AiAttackAttr_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'AiAttackAttr'失败!");
}
_InitActivePropBaseRef();
_InitEnemyBaseRef();
_InitActivityBaseRef();
}
private static void _InitBuffPropBaseConfig()
{
@ -214,60 +142,6 @@ public static partial class ExcelConfig
throw new Exception("初始化表'BuffPropBase'失败!");
}
}
private static void _InitBulletBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/BulletBase.json");
BulletBase_List = JsonSerializer.Deserialize<List<BulletBase>>(text);
BulletBase_Map = new Dictionary<string, BulletBase>();
foreach (var item in BulletBase_List)
{
BulletBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'BulletBase'失败!");
}
}
private static void _InitEnemyBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/EnemyBase.json");
EnemyBase_List = new List<EnemyBase>(JsonSerializer.Deserialize<List<Ref_EnemyBase>>(text));
EnemyBase_Map = new Dictionary<string, EnemyBase>();
foreach (var item in EnemyBase_List)
{
EnemyBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'EnemyBase'失败!");
}
}
private static void _InitLiquidMaterialConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/LiquidMaterial.json");
LiquidMaterial_List = JsonSerializer.Deserialize<List<LiquidMaterial>>(text);
LiquidMaterial_Map = new Dictionary<string, LiquidMaterial>();
foreach (var item in LiquidMaterial_List)
{
LiquidMaterial_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'LiquidMaterial'失败!");
}
}
private static void _InitSoundConfig()
{
try
@ -304,45 +178,133 @@ public static partial class ExcelConfig
throw new Exception("初始化表'WeaponBase'失败!");
}
}
private static void _InitActivePropBaseRef()
private static void _InitActivityMaterialConfig()
{
foreach (Ref_ActivePropBase item in ActivePropBase_List)
try
{
try
var text = _ReadConfigAsText("res://resource/config/ActivityMaterial.json");
ActivityMaterial_List = JsonSerializer.Deserialize<List<ActivityMaterial>>(text);
ActivityMaterial_Map = new Dictionary<string, ActivityMaterial>();
foreach (var item in ActivityMaterial_List)
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivePropBase'引用其他表数据失败, 当前行id: " + item.Id);
ActivityMaterial_Map.Add(item.Id, item);
}
}
}
private static void _InitActivityBaseRef()
{
foreach (Ref_ActivityBase item in ActivityBase_List)
catch (Exception e)
{
try
{
if (!string.IsNullOrEmpty(item.__Material))
{
item.Material = ActivityMaterial_Map[item.__Material];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id);
}
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivityMaterial'失败!");
}
}
private static void _InitAiAttackAttrConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/AiAttackAttr.json");
AiAttackAttr_List = JsonSerializer.Deserialize<List<AiAttackAttr>>(text);
AiAttackAttr_Map = new Dictionary<string, AiAttackAttr>();
foreach (var item in AiAttackAttr_List)
{
AiAttackAttr_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'AiAttackAttr'失败!");
}
}
private static void _InitBulletBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/BulletBase.json");
BulletBase_List = JsonSerializer.Deserialize<List<BulletBase>>(text);
BulletBase_Map = new Dictionary<string, BulletBase>();
foreach (var item in BulletBase_List)
{
BulletBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'BulletBase'失败!");
}
}
private static void _InitActivePropBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivePropBase.json");
ActivePropBase_List = new List<ActivePropBase>(JsonSerializer.Deserialize<List<Ref_ActivePropBase>>(text));
ActivePropBase_Map = new Dictionary<string, ActivePropBase>();
foreach (var item in ActivePropBase_List)
{
ActivePropBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivePropBase'失败!");
}
}
private static void _InitEnemyBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/EnemyBase.json");
EnemyBase_List = new List<EnemyBase>(JsonSerializer.Deserialize<List<Ref_EnemyBase>>(text));
EnemyBase_Map = new Dictionary<string, EnemyBase>();
foreach (var item in EnemyBase_List)
{
EnemyBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'EnemyBase'失败!");
}
}
private static void _InitActivityBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivityBase.json");
ActivityBase_List = new List<ActivityBase>(JsonSerializer.Deserialize<List<Ref_ActivityBase>>(text));
ActivityBase_Map = new Dictionary<string, ActivityBase>();
foreach (var item in ActivityBase_List)
{
ActivityBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivityBase'失败!");
}
}
private static void _InitLiquidMaterialConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/LiquidMaterial.json");
LiquidMaterial_List = JsonSerializer.Deserialize<List<LiquidMaterial>>(text);
LiquidMaterial_Map = new Dictionary<string, LiquidMaterial>();
foreach (var item in LiquidMaterial_List)
{
LiquidMaterial_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'LiquidMaterial'失败!");
}
}
private static void _InitBuffPropBaseRef()
{
foreach (Ref_BuffPropBase item in BuffPropBase_List)
@ -362,25 +324,6 @@ public static partial class ExcelConfig
}
}
}
private static void _InitEnemyBaseRef()
{
foreach (Ref_EnemyBase item in EnemyBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitWeaponBaseRef()
{
foreach (Ref_WeaponBase item in WeaponBase_List)
@ -449,6 +392,63 @@ public static partial class ExcelConfig
}
}
}
private static void _InitActivePropBaseRef()
{
foreach (Ref_ActivePropBase item in ActivePropBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivePropBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitEnemyBaseRef()
{
foreach (Ref_EnemyBase item in EnemyBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitActivityBaseRef()
{
foreach (Ref_ActivityBase item in ActivityBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Material))
{
item.Material = ActivityMaterial_Map[item.__Material];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static string _ReadConfigAsText(string path)
{
var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);

View File

@ -30,6 +30,7 @@ public static partial class ExcelConfig
/// Effect(特效): 8 <br/>
/// Prop(道具): 9 <br/>
/// Treasure(宝箱): 10 <br/>
/// Npc: 11 <br/>
/// Other(其它类型): 99
/// </summary>
[JsonInclude]

View File

@ -14,9 +14,18 @@ public partial class ActivityObject
{
throw new Exception("实例化 ActivityObject 前请先调用 'GameApplication.Instance.DungeonManager.CreateNewWorld()' 初始化 World 对象");
}
var instance = ResourceManager.LoadAndInstantiate<ActivityObject>(config.Prefab);
instance._InitNode(config, world);
return instance;
try
{
var instance = ResourceManager.LoadAndInstantiate<ActivityObject>(config.Prefab);
instance._InitNode(config, world);
return instance;
}
catch (Exception e)
{
Debug.LogError($"创建实例'{config.Id}'失败, 错误信息: {e.Message}\n{e.StackTrace}");
throw;
}
}
/// <summary>

View File

@ -24,6 +24,11 @@ public partial class ActivityObject
/// </summary>
public const string Id_enemy0002 = "enemy0002";
/// <summary>
/// 名称: 商店老板 <br/>
/// 简介: 商店老板
/// </summary>
public const string Id_shopBoss0001 = "shopBoss0001";
/// <summary>
/// 名称: 步枪 <br/>
/// 简介:
/// </summary>

View File

@ -49,6 +49,10 @@ public enum ActivityType
/// </summary>
Treasure,
/// <summary>
/// Npc
/// </summary>
Npc,
/// <summary>
/// 其它类型
/// </summary>
Other = 99,

View File

@ -226,8 +226,8 @@ public class RoomPreinstall : IDestroy
private void HandlerShopBossMark(World world, MarkInfo markInfo, ActivityMark mark)
{
mark.Id = ActivityObject.Ids.Id_treasure_box0001;
mark.ActivityType = ActivityType.Treasure;
mark.Id = ActivityObject.Ids.Id_shopBoss0001;
mark.ActivityType = ActivityType.Npc;
mark.Altitude = 0;
}
@ -466,12 +466,16 @@ public class RoomPreinstall : IDestroy
//获取物体默认所在层级
private RoomLayerEnum GetDefaultLayer(ActivityMark activityMark)
{
if (activityMark.ActivityType == ActivityType.Player || activityMark.ActivityType == ActivityType.Enemy || activityMark.ActivityType == ActivityType.Treasure)
switch (activityMark.ActivityType)
{
return RoomLayerEnum.YSortLayer;
case ActivityType.Player:
case ActivityType.Enemy:
case ActivityType.Npc:
case ActivityType.Treasure:
return RoomLayerEnum.YSortLayer;
default:
return RoomLayerEnum.NormalLayer;
}
return RoomLayerEnum.NormalLayer;
}
/// <summary>

View File

@ -76,6 +76,11 @@ public abstract partial class AiRole : Role
/// </summary>
public float AttackInterval { get; set; } = 0;
/// <summary>
/// 当前Ai是否有攻击欲望
/// </summary>
public bool HasAttackDesire { get; private set; } = true;
public override void OnInit()
{
base.OnInit();
@ -101,7 +106,7 @@ public abstract partial class AiRole : Role
}
/// <summary>
/// 获取攻击的目标对象, 该函数不能返回 null
/// 获取攻击的目标对象, 当 HasAttackDesire 为 true 时才会调用
/// </summary>
public virtual Role GetAttackTarget()
{
@ -388,6 +393,18 @@ public abstract partial class AiRole : Role
Destroy();
}
/// <summary>
/// 设置Ai是否有攻击欲望
/// </summary>
public void SetAttackDesire(bool v)
{
if (v != HasAttackDesire)
{
HasAttackDesire = v;
StateController.ChangeState(AIStateEnum.AiNormal);
}
}
// private void OnVelocityComputed(Vector2 velocity)
// {
// if (Mathf.Abs(velocity.X) >= 0.01f && Mathf.Abs(velocity.Y) >= 0.01f)

View File

@ -34,7 +34,10 @@ public class AiAstonishedState : StateBase<AiRole, AIStateEnum>
_timer = 0.6f;
//播放惊讶表情
Master.AnimationPlayer.Play(AnimatorNames.Astonished);
if (Master.AnimationPlayer.HasAnimation(AnimatorNames.Astonished))
{
Master.AnimationPlayer.Play(AnimatorNames.Astonished);
}
}
public override void Process(float delta)

View File

@ -54,7 +54,10 @@ public class AiFindAmmoState : StateBase<AiRole, AIStateEnum>
_playAnimFlag = prev == AIStateEnum.AiLeaveFor;
if (_playAnimFlag)
{
Master.AnimationPlayer.Play(AnimatorNames.Query);
if (Master.AnimationPlayer.HasAnimation(AnimatorNames.Query))
{
Master.AnimationPlayer.Play(AnimatorNames.Query);
}
}
}
@ -74,18 +77,21 @@ public class AiFindAmmoState : StateBase<AiRole, AIStateEnum>
if (Master.LookTarget == null) //没有目标
{
//临时处理
//攻击目标
var attackTarget = Master.GetAttackTarget();
var targetPos = attackTarget.GetCenterPosition();
if (Master.IsInViewRange(targetPos) && !Master.TestViewRayCast(targetPos)) //发现玩家
if (attackTarget != null)
{
//关闭射线检测
Master.TestViewRayCastOver();
//发现玩家
Master.LookTarget = attackTarget;
//进入惊讶状态, 然后再进入通知状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiFindAmmo, TargetWeapon);
return;
var targetPos = attackTarget.GetCenterPosition();
if (Master.IsInViewRange(targetPos) && !Master.TestViewRayCast(targetPos)) //发现玩家
{
//关闭射线检测
Master.TestViewRayCastOver();
//发现玩家
Master.LookTarget = attackTarget;
//进入惊讶状态, 然后再进入通知状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiFindAmmo, TargetWeapon);
return;
}
}
}

View File

@ -53,7 +53,10 @@ public class AiLeaveForState : StateBase<AiRole, AIStateEnum>
_playAnimFlag = prev != AIStateEnum.AiFindAmmo;
if (_playAnimFlag)
{
Master.AnimationPlayer.Play(AnimatorNames.Query);
if (Master.AnimationPlayer.HasAnimation(AnimatorNames.Query))
{
Master.AnimationPlayer.Play(AnimatorNames.Query);
}
}
//看向目标位置
@ -101,27 +104,31 @@ public class AiLeaveForState : StateBase<AiRole, AIStateEnum>
//站立
Master.DoIdle();
}
//攻击目标
var attackTarget = Master.GetAttackTarget();
var targetPos = attackTarget.GetCenterPosition();
//检测玩家是否在视野内, 如果在, 则切换到 AiTargetInView 状态
if (Master.IsInTailAfterViewRange(targetPos))
if (attackTarget != null)
{
if (!Master.TestViewRayCast(targetPos)) //看到玩家
var targetPos = attackTarget.GetCenterPosition();
//检测玩家是否在视野内, 如果在, 则切换到 AiTargetInView 状态
if (Master.IsInTailAfterViewRange(targetPos))
{
//关闭射线检测
Master.TestViewRayCastOver();
//切换成发现目标状态
Master.LookTarget = attackTarget;
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiFollowUp);
return;
}
else
{
//关闭射线检测
Master.TestViewRayCastOver();
if (!Master.TestViewRayCast(targetPos)) //看到玩家
{
//关闭射线检测
Master.TestViewRayCastOver();
//切换成发现目标状态
Master.LookTarget = attackTarget;
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiFollowUp);
return;
}
else
{
//关闭射线检测
Master.TestViewRayCastOver();
}
}
}
//移动到目标掉了, 还没发现目标
if (Master.NavigationAgent2D.IsNavigationFinished())

View File

@ -46,33 +46,40 @@ public class AiNormalState : StateBase<AiRole, AIStateEnum>
public override void Process(float delta)
{
//获取攻击目标
var attackTarget = Master.GetAttackTarget();
//玩家中心点坐标
var targetPos = attackTarget.GetCenterPosition();
if (Master.IsInViewRange(targetPos) && !Master.TestViewRayCast(targetPos)) //发现目标
if (Master.HasAttackDesire) //有攻击欲望
{
//关闭射线检测
Master.TestViewRayCastOver();
//发现玩家
Master.LookTarget = attackTarget;
//判断是否进入通知状态
if (Master.World.Enemy_InstanceList.FindIndex(enemy =>
enemy != Master && !enemy.IsDie && enemy.AffiliationArea == Master.AffiliationArea &&
enemy.StateController.CurrState == AIStateEnum.AiNormal) != -1)
//获取攻击目标
var attackTarget = Master.GetAttackTarget();
if (attackTarget != null)
{
//进入惊讶状态, 然后再进入通知状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiNotify);
//玩家中心点坐标
var targetPos = attackTarget.GetCenterPosition();
if (Master.IsInViewRange(targetPos) && !Master.TestViewRayCast(targetPos)) //发现目标
{
//关闭射线检测
Master.TestViewRayCastOver();
//发现玩家
Master.LookTarget = attackTarget;
//判断是否进入通知状态
if (Master.World.Enemy_InstanceList.FindIndex(enemy =>
enemy != Master && !enemy.IsDie && enemy.AffiliationArea == Master.AffiliationArea &&
enemy.StateController.CurrState == AIStateEnum.AiNormal) != -1)
{
//进入惊讶状态, 然后再进入通知状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiNotify);
}
else
{
//进入惊讶状态, 然后再进入跟随状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiTailAfter);
}
return;
}
}
else
{
//进入惊讶状态, 然后再进入跟随状态
ChangeState(AIStateEnum.AiAstonished, AIStateEnum.AiTailAfter);
}
return;
}
else if (_pauseTimer >= 0)
if (_pauseTimer >= 0)
{
Master.AnimatedSprite.Play(AnimatorNames.Idle);
_pauseTimer -= delta;

View File

@ -22,7 +22,10 @@ public class AiNotifyState : StateBase<AiRole, AIStateEnum>
_timer = 1.2f;
//通知其它角色
Master.World.NotifyEnemyTarget(Master, Master.LookTarget);
Master.AnimationPlayer.Play(AnimatorNames.Notify);
if (Master.AnimationPlayer.HasAnimation(AnimatorNames.Notify))
{
Master.AnimationPlayer.Play(AnimatorNames.Notify);
}
}
public override void Process(float delta)

View File

@ -7,6 +7,19 @@ using Godot;
[Tool]
public partial class ShopBoss : AiRole
{
public override void OnInit()
{
base.OnInit();
SetAttackDesire(false);
}
protected override RoleState OnCreateRoleState()
{
var roleState = new RoleState();
roleState.MoveSpeed = 50;
return roleState;
}
public override void OnCreateWithMark(RoomPreinstall roomPreinstall, ActivityMark activityMark)
{

View File

@ -47,4 +47,8 @@ public class PhysicsLayer
/// 障碍物
/// </summary>
public const uint Obstacle = 0b1000000000;
/// <summary>
/// npc
/// </summary>
public const uint Npc = 0b10000000000;
}