diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn index 80a0813..ae17ba9 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn @@ -1,17 +1,32 @@ [gd_scene load_steps=4 format=3 uid="uid://dmeb88jotqro6"] -[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="1_uyixn"] -[ext_resource type="Script" path="res://src/framework/map/DungeonRoomTemplate.cs" id="2_8m22j"] -[ext_resource type="Script" path="res://src/framework/map/mark/ActivityMark.cs" id="3_16tk5"] +[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="1_osa3n"] +[ext_resource type="Script" path="res://src/framework/map/DungeonRoomTemplate.cs" id="2_erhdx"] +[ext_resource type="Script" path="res://src/framework/map/mark/ActivityMark.cs" id="3_m4jrh"] [node name="Room1" type="TileMap"] -tile_set = ExtResource("1_uyixn") +tile_set = ExtResource("1_osa3n") format = 2 layer_0/tile_data = PackedInt32Array(327689, 0, 8, 262153, 0, 8, 196617, 0, 8, 131081, 0, 8, 65545, 0, 8, 9, 0, 8, 327688, 0, 8, 262152, 0, 8, 196616, 0, 8, 131080, 0, 8, 65544, 0, 8, 8, 0, 8, 327687, 0, 8, 262151, 0, 8, 196615, 0, 8, 131079, 0, 8, 65543, 0, 8, 7, 0, 8, 327686, 0, 8, 262150, 0, 8, 196614, 0, 8, 131078, 0, 8, 65542, 0, 8, 6, 0, 8, 327685, 0, 8, 262149, 0, 8, 196613, 0, 8, 131077, 0, 8, 65541, 0, 8, 5, 0, 8, 327684, 0, 8, 262148, 0, 8, 196612, 0, 8, 131076, 0, 8, 65540, 0, 8, 4, 0, 8, 327683, 0, 8, 262147, 0, 8, 196611, 0, 8, 131075, 0, 8, 65539, 0, 8, 3, 0, 8, 327682, 0, 8, 262146, 0, 8, 196610, 0, 8, 131074, 0, 8, 65538, 0, 8, 2, 0, 8, 327681, 0, 8, 262145, 0, 8, 196609, 0, 8, 131073, 0, 8, 65537, 0, 8, 1, 0, 8, 327680, 0, 8, 262144, 0, 8, 196608, 0, 8, 131072, 0, 8, 65536, 0, 8, 0, 0, 8, 131071, 196608, 3, 65535, 196608, 3, -1, 196608, 4, -65536, 131072, 7, -65535, 131072, 7, 196607, 196608, 3, 262143, 196608, 3, 327679, 196608, 3, 393215, 196608, 3, 393217, 131072, 2, 393216, 131072, 2, 458751, 720896, 2, -65534, 131072, 7, 393218, 131072, 2, -65533, 131072, 7, 393219, 131072, 2, -65532, 131072, 7, 393220, 131072, 2, -65531, 131072, 7, 393221, 131072, 2, -65530, 131072, 7, 393222, 131072, 2, -65529, 131072, 7, 393223, 131072, 2, -65528, 131072, 7, 393224, 131072, 2, -65527, 131072, 7, 393225, 131072, 2, 10, 65536, 3, 65546, 65536, 3, -65526, 65536, 4, 131082, 65536, 3, 196618, 65536, 3, 262154, 65536, 3, 327690, 65536, 3, 393226, 851968, 2) -script = ExtResource("2_8m22j") +script = ExtResource("2_erhdx") [node name="Player" type="Node2D" parent="."] position = Vector2(80, 47) -script = ExtResource("3_16tk5") +script = ExtResource("3_m4jrh") Type = 1 Altitude = 0 + +[node name="ActivityMark" type="Node2D" parent="."] +position = Vector2(129, 22) +script = ExtResource("3_m4jrh") +Type = 5 +ItemExpression = "0001" +WaveNumber = 2 + +[node name="ActivityMark2" type="Node2D" parent="."] +position = Vector2(29, 75) +script = ExtResource("3_m4jrh") +Type = 5 +ItemExpression = "0003 +" +WaveNumber = 3 diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index d6306be..2116d08 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -301,8 +301,10 @@ if (Engine.IsEditorHint()) { _InitNodeInEditor(); + return; } #endif + EnterTree(); } /// @@ -310,7 +312,14 @@ /// public sealed override void _ExitTree() { - +#if TOOLS + // 在工具模式下创建的 template 节点自动创建对应的必要子节点 + if (Engine.IsEditorHint()) + { + return; + } +#endif + ExitTree(); } /// diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs index db67c2a..3b7631a 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs @@ -6,157 +6,6 @@ [Tool, GlobalClass] public partial class Gun : Weapon { - // //步枪属性数据 - // private class RifleAttribute : WeaponAttribute - // { - // public RifleAttribute() - // { - // Name = "步枪"; - // Icon = ResourcePath.resource_sprite_gun_gun4_png; - // SpriteFrames = ResourcePath.resource_spriteFrames_Weapon0001_tres; - // Weight = 40; - // ThrowSpritePosition = new Vector2(0.4f, -2.6f); - // StartFiringSpeed = 480; - // StartScatteringRange = 30; - // FinalScatteringRange = 90; - // ScatteringRangeAddValue = 2f; - // ScatteringRangeBackSpeed = 40; - // //连发 - // ContinuousShoot = true; - // AmmoCapacity = 30; - // StandbyAmmoCapacity = 30 * 3; - // MaxAmmoCapacity = 30 * 3; - // //扳机检测间隔 - // TriggerInterval = 0f; - // - // //开火前延时 - // DelayedTime = 0f; - // //攻击距离 - // MinDistance = 300; - // MaxDistance = 400; - // //发射子弹数量 - // MinFireBulletCount = 1; - // MaxFireBulletCount = 1; - // //抬起角度 - // UpliftAngle = 10; - // //开火位置 - // FirePosition = new Vector2(21, -3f); - // //精灵位置 - // SpritePosition = new Vector2(6, -1); - // ShellPosition = new Vector2(7.5f, -4.5f); - // - // AiUseAttribute = Clone(); - // AiUseAttribute.AiTargetLockingTime = 0.5f; - // AiUseAttribute.TriggerInterval = 3f; - // AiUseAttribute.ContinuousShoot = false; - // AiUseAttribute.MinContinuousCount = 3; - // AiUseAttribute.MaxContinuousCount = 3; - // } - // } - // - // //手枪属性数据 - // private class PistolAttribute : WeaponAttribute - // { - // public PistolAttribute() - // { - // Name = "手枪"; - // Icon = ResourcePath.resource_sprite_gun_gun3_png; - // SpriteFrames = ResourcePath.resource_spriteFrames_Weapon0003_tres; - // Weight = 20; - // ThrowSpritePosition = new Vector2(0.4f, -2.6f); - // WeightType = WeaponWeightType.DeputyWeapon; - // StartFiringSpeed = 300; - // FinalFiringSpeed = 300; - // StartScatteringRange = 5; - // FinalScatteringRange = 60; - // ScatteringRangeAddValue = 8f; - // ScatteringRangeBackSpeed = 40; - // ScatteringRangeBackTime = 0.5f; - // //连发 - // ContinuousShoot = false; - // AmmoCapacity = 12; - // StandbyAmmoCapacity = 72; - // MaxAmmoCapacity = 72; - // //扳机检测间隔 - // TriggerInterval = 0.1f; - // //连发数量 - // MinContinuousCount = 1; - // MaxContinuousCount = 1; - // //开火前延时 - // DelayedTime = 0f; - // //攻击距离 - // MinDistance = 250; - // MaxDistance = 300; - // //发射子弹数量 - // MinFireBulletCount = 1; - // MaxFireBulletCount = 1; - // //抬起角度 - // UpliftAngle = 20; - // //开火位置 - // FirePosition = new Vector2(13, -2); - // //精灵位置 - // SpritePosition = new Vector2(5, 0); - // ShellPosition = new Vector2(5, -3); - // - // AiUseAttribute = Clone(); - // AiUseAttribute.AiTargetLockingTime = 1f; - // AiUseAttribute.TriggerInterval = 2f; - // } - // } - // - // //狙击步枪 - // private class SniperRifleAttribute : WeaponAttribute - // { - // public SniperRifleAttribute() - // { - // Name = "狙击步枪"; - // Icon = ResourcePath.resource_sprite_gun_gun3_png; - // SpriteFrames = ResourcePath.resource_spriteFrames_Weapon0005_tres; - // Weight = 20; - // ThrowSpritePosition = new Vector2(0.4f, -2.6f); - // WeightType = WeaponWeightType.DeputyWeapon; - // StartFiringSpeed = 60; - // FinalFiringSpeed = 60; - // StartScatteringRange = 0; - // FinalScatteringRange = 20; - // ScatteringRangeAddValue = 10; - // ScatteringRangeBackSpeed = 10; - // //连发 - // ContinuousShoot = false; - // AmmoCapacity = 10; - // StandbyAmmoCapacity = 50; - // MaxAmmoCapacity = 50; - // //扳机检测间隔 - // TriggerInterval = 0.1f; - // //连发数量 - // MinContinuousCount = 1; - // MaxContinuousCount = 1; - // //开火前延时 - // DelayedTime = 0f; - // //攻击距离 - // MinDistance = 600; - // MaxDistance = 800; - // //发射子弹数量 - // MinFireBulletCount = 1; - // MaxFireBulletCount = 1; - // //抬起角度 - // UpliftAngle = 15; - // UpliftAngleRestore = 3.5f; - // //开火位置 - // FirePosition = new Vector2(28, -3.5f); - // //精灵位置 - // SpritePosition = new Vector2(9, 0); - // ShellPosition = new Vector2(7, -3.5f); - // MinBacklash = 6; - // MinBacklash = 8; - // BacklashRegressionSpeed = 20; - // ReloadTime = 3.5f; - // - // AiUseAttribute = Clone(); - // AiUseAttribute.AiTargetLockingTime = 1f; - // AiUseAttribute.TriggerInterval = 2f; - // } - // } protected override void OnFire() { diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Shotgun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Shotgun.cs index de45035..6928687 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Shotgun.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Shotgun.cs @@ -3,58 +3,6 @@ [Tool, GlobalClass] public partial class Shotgun : Weapon { - - // private class ShotgunAttribute : WeaponAttribute - // { - // public ShotgunAttribute() - // { - // Name = "霰弹枪"; - // Icon = ResourcePath.resource_sprite_gun_gun2_png; - // SpriteFrames = ResourcePath.resource_spriteFrames_Weapon0002_tres; - // Weight = 40; - // ThrowSpritePosition = new Vector2(0.4f, -2.6f); - // StartFiringSpeed = 400; - // StartScatteringRange = 30; - // FinalScatteringRange = 90; - // ScatteringRangeAddValue = 50f; - // ScatteringRangeBackSpeed = 50; - // //连发 - // ContinuousShoot = false; - // AmmoCapacity = 7; - // StandbyAmmoCapacity = 42; - // MaxAmmoCapacity = 42; - // AloneReload = true; - // AloneReloadCanShoot = true; - // ReloadTime = 0.6f; - // //连发数量 - // MinContinuousCount = 1; - // MaxContinuousCount = 1; - // //开火前延时 - // DelayedTime = 0f; - // //攻击距离 - // MinDistance = 200; - // MaxDistance = 250; - // //发射子弹数量 - // MinFireBulletCount = 5; - // MaxFireBulletCount = 5; - // //抬起角度 - // UpliftAngle = 15; - // MaxBacklash = 6; - // MinBacklash = 5; - // //开火位置 - // FirePosition = new Vector2(22, -4); - // //精灵位置 - // SpritePosition = new Vector2(9, -2); - // ShellPosition = new Vector2(3, -4); - // - // BulletId = ActivityIdPrefix.Bullet + "0002"; - // - // AiUseAttribute = Clone(); - // AiUseAttribute.AiTargetLockingTime = 0.2f; - // AiUseAttribute.TriggerInterval = 3.5f; - // } - // } - protected override void OnFire() { //创建一个弹壳 diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs index 4912170..8d97533 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs @@ -4,36 +4,7 @@ [Tool, GlobalClass] public partial class Knife : Weapon { - // private class KnifeAttribute : WeaponAttribute - // { - // public KnifeAttribute() - // { - // Icon = ResourcePath.resource_sprite_gun_knife1_png; - // WeaponPrefab = ResourcePath.prefab_weapon_Knife_tscn; - // //攻速设置 - // StartFiringSpeed = 180; - // FinalFiringSpeed = StartFiringSpeed; - // //关闭连发 - // ContinuousShoot = false; - // //设置成松发开火 - // LooseShoot = true; - // //弹药量, 可以理解为耐久度 - // AmmoCapacity = 180; - // MaxAmmoCapacity = AmmoCapacity; - // //握把位置 - // SpritePosition = new Vector2(10, 0); - // MaxDistance = MinDistance = 35; - // //后坐力改为向前, 模拟手伸长的效果 - // MaxBacklash = -8; - // MinBacklash = -8; - // BacklashRegressionSpeed = 24; - // UpliftAngle = -95; - // - // //AiUseAttribute = Clone(); - // //AiUseAttribute.TriggerInterval = 3f; - // } - // } - + private Area2D _hitArea; private int _attackIndex = 0; diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index f28aa01..244e1e7 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -150,14 +150,14 @@ //玩家手上添加武器 //player.PickUpWeapon(ActivityObject.Create(ActivityObject.Ids.Id_weapon0001)); - var weapon = ActivityObject.Create(ActivityObject.Ids.Id_weapon0001); - weapon.PutDown(player.Position, RoomLayerEnum.NormalLayer); - var weapon2 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0002); - weapon2.PutDown(player.Position, RoomLayerEnum.NormalLayer); - var weapon3 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0003); - weapon3.PutDown(player.Position, RoomLayerEnum.NormalLayer); - var weapon4 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0004); - weapon4.PutDown(player.Position, RoomLayerEnum.NormalLayer); + // var weapon = ActivityObject.Create(ActivityObject.Ids.Id_weapon0001); + // weapon.PutDown(player.Position, RoomLayerEnum.NormalLayer); + // var weapon2 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0002); + // weapon2.PutDown(player.Position, RoomLayerEnum.NormalLayer); + // var weapon3 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0003); + // weapon3.PutDown(player.Position, RoomLayerEnum.NormalLayer); + // var weapon4 = ActivityObject.Create(ActivityObject.Ids.Id_weapon0004); + // weapon4.PutDown(player.Position, RoomLayerEnum.NormalLayer); GameApplication.Instance.Cursor.SetGuiMode(false); yield return 0;