diff --git a/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png b/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png new file mode 100644 index 0000000..59c7e12 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png.import b/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png.import new file mode 100644 index 0000000..2536123 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/effects/explode/Explode_pit0001.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://6p1iq7sgw8lt" +path="res://.godot/imported/Explode_pit0001.png-e0ae86a6c1b6531083be57c318c78f11.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/effects/explode/Explode_pit0001.png" +dest_files=["res://.godot/imported/Explode_pit0001.png-e0ae86a6c1b6531083be57c318c78f11.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs index 395cf7d..e108396 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs @@ -40,10 +40,20 @@ public void PlayBoom() { var explode = ObjectManager.GetExplode(ResourcePath.prefab_bullet_explode_Explode0001_tscn); - explode.Position = Position; + var pos = Position; + explode.Position = pos; explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360); explode.AddToActivityRootDeferred(RoomLayerEnum.YSortLayer); explode.Init(BulletData.TriggerRole?.AffiliationArea, AttackLayer, 25, BulletData.MinHarm, BulletData.MaxHarm, 50, 150); explode.RunPlay(); + if (AffiliationArea != null) + { + var texture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_effects_explode_Explode_pit0001_png); + var tempPos = AffiliationArea.RoomInfo.ToImageCanvasPosition(pos); + AffiliationArea.RoomInfo.StaticImageCanvas.DrawImageInCanvas( + texture, null, tempPos.X, tempPos.Y, Utils.Random.RandomRangeInt(0, 360), + texture.GetWidth() / 2, texture.GetHeight() / 2, false + ); + } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs index 687e524..0c24cdc 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs @@ -49,6 +49,10 @@ if (triggerRole != null) { altitude = -triggerRole.MountPoint.Position.Y; + if (triggerRole.AffiliationArea != null) //设置所属区域 + { + triggerRole.AffiliationArea.InsertItem(this); + } } else { diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index bcd9306..a3d92ff 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -685,7 +685,7 @@ { return Master == null && GetParent() == GameApplication.Instance.World.NormalLayer; } - + /// /// 扳机函数, 调用即视为按下扳机 /// @@ -713,10 +713,10 @@ TriggerRoleAttackLayer = Master.AttackLayer; _weaponAttribute = Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute; } - + //是否第一帧按下 var justDown = _downTimer == 0; - if (_beLoadedState == 0 || _beLoadedState == -1) //需要执行上膛操作 + if (_beLoadedState == 0 || _beLoadedState == -1) //需要执行上膛操作 { if (justDown && !Reloading && triggerRole != null) { @@ -732,9 +732,9 @@ } } } - else if (_beLoadedState == 1) //上膛中 + else if (_beLoadedState == 1) //上膛中 { - + } else //上膛完成 { @@ -804,6 +804,7 @@ { _delayedTime = Attribute.DelayedTime; } + //扳机按下间隔 _triggerTimer = Attribute.TriggerInterval; //连发数量 @@ -835,6 +836,14 @@ } } } + else //不能开火 + { + if (CurrAmmo <= 0 && justDown && triggerRole != null) //子弹不够 + { + //第一帧按下, 触发换弹 + Reload(); + } + } } } diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 39004a4..03b63e2 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -14,6 +14,7 @@ public const string prefab_bullet_normal_Bullet0001_tscn = "res://prefab/bullet/normal/Bullet0001.tscn"; public const string prefab_bullet_normal_Bullet0002_tscn = "res://prefab/bullet/normal/Bullet0002.tscn"; public const string prefab_bullet_normal_Bullet0003_tscn = "res://prefab/bullet/normal/Bullet0003.tscn"; + public const string prefab_bullet_normal_Bullet0004_tscn = "res://prefab/bullet/normal/Bullet0004.tscn"; public const string prefab_effect_Blood_tscn = "res://prefab/effect/Blood.tscn"; public const string prefab_effect_common_Effect1_tscn = "res://prefab/effect/common/Effect1.tscn"; public const string prefab_effect_enemy_Effect0001_tscn = "res://prefab/effect/enemy/Effect0001.tscn"; @@ -82,6 +83,7 @@ public const string prefab_weapon_Weapon0009_tscn = "res://prefab/weapon/Weapon0009.tscn"; public const string prefab_weapon_WeaponTemplate_tscn = "res://prefab/weapon/WeaponTemplate.tscn"; public const string resource_config_ActivityBase_json = "res://resource/config/ActivityBase.json"; + public const string resource_config_ActivityMaterial_json = "res://resource/config/ActivityMaterial.json"; public const string resource_config_AiAttackAttr_json = "res://resource/config/AiAttackAttr.json"; public const string resource_config_BulletBase_json = "res://resource/config/BulletBase.json"; public const string resource_config_Sound_json = "res://resource/config/Sound.json"; @@ -151,6 +153,7 @@ public const string resource_sprite_bullet_normal_bullet0001_png = "res://resource/sprite/bullet/normal/bullet0001.png"; public const string resource_sprite_bullet_normal_bullet0002_png = "res://resource/sprite/bullet/normal/bullet0002.png"; public const string resource_sprite_bullet_normal_bullet0003_png = "res://resource/sprite/bullet/normal/bullet0003.png"; + public const string resource_sprite_bullet_normal_bullet0004_png = "res://resource/sprite/bullet/normal/bullet0004.png"; public const string resource_sprite_bullet_normal_bullet2_png = "res://resource/sprite/bullet/normal/bullet2.png"; public const string resource_sprite_effects_Circle_png = "res://resource/sprite/effects/Circle.png"; public const string resource_sprite_effects_Circle2_png = "res://resource/sprite/effects/Circle2.png"; @@ -161,6 +164,7 @@ public const string resource_sprite_effects_common_Smoke2_png = "res://resource/sprite/effects/common/Smoke2.png"; public const string resource_sprite_effects_explode_Explode_circle0001_png = "res://resource/sprite/effects/explode/Explode_circle0001.png"; public const string resource_sprite_effects_explode_Explode_line0001_png = "res://resource/sprite/effects/explode/Explode_line0001.png"; + public const string resource_sprite_effects_explode_Explode_pit0001_png = "res://resource/sprite/effects/explode/Explode_pit0001.png"; public const string resource_sprite_effects_weapon_Collision1_png = "res://resource/sprite/effects/weapon/Collision1.png"; public const string resource_sprite_effects_weapon_KnifeHit1_png = "res://resource/sprite/effects/weapon/KnifeHit1.png"; public const string resource_sprite_effects_weapon_MeleeAttack1_png = "res://resource/sprite/effects/weapon/MeleeAttack1.png"; @@ -299,6 +303,7 @@ public const string resource_spriteFrames_bullet_Bullet0001_tres = "res://resource/spriteFrames/bullet/Bullet0001.tres"; public const string resource_spriteFrames_bullet_Bullet0002_tres = "res://resource/spriteFrames/bullet/Bullet0002.tres"; public const string resource_spriteFrames_bullet_Bullet0003_tres = "res://resource/spriteFrames/bullet/Bullet0003.tres"; + public const string resource_spriteFrames_bullet_Bullet0004_tres = "res://resource/spriteFrames/bullet/Bullet0004.tres"; public const string resource_spriteFrames_effect_KnifeHit1_tres = "res://resource/spriteFrames/effect/KnifeHit1.tres"; public const string resource_spriteFrames_other_RoomDoor_E_Down_tres = "res://resource/spriteFrames/other/RoomDoor_E_Down.tres"; public const string resource_spriteFrames_other_RoomDoor_E_Up_tres = "res://resource/spriteFrames/other/RoomDoor_E_Up.tres";