diff --git a/locals/Log.csv b/locals/Log.csv index 365619d..6975cec 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -113,4 +113,6 @@ log_enter_the_screen,进入屏幕。,Enter screen,画面に移動。 log_exit_the_screen,退出屏幕。,Exit screen,画面を終了します。 log_failed_to_create_room_preview,创建{0}的房间预览图失败。,Failed to create a room preview of the {0}.,{0}の部屋のプレビューを作成できませんでした。 log_generated_item_is_empty,生成的物品{0}是空的吗{1}。,Generated item {0} is empty {1}.,生成したアイテム{0}は空ですか{1}。 -log_projectile_generate_magic_is_null,没有装填可提供抛射体的法术。,There is no reload spell that provides projectiles.,射出体を提供するスペルを装填していません。 \ No newline at end of file +log_projectile_generate_magic_is_null,没有装填可提供抛射体的法术。,There is no reload spell that provides projectiles.,射出体を提供するスペルを装填していません。 +log_projectile_scene_is_null,抛射体场景为空。,Projectile scene is empty.,射出体は空です。 +log_projectile_is_null,抛射体为空。,Projectile scene is empty.,射出シーンは空です。 \ No newline at end of file diff --git a/locals/Slogan.csv b/locals/Slogan.csv index e9a1f5d..d931388 100644 --- a/locals/Slogan.csv +++ b/locals/Slogan.csv @@ -4,3 +4,8 @@ slogan_1,Kawaii!,Kawaii!,Kawaii! slogan_2,魔法是想象的世界。,Magic is an imaginary world.,魔法は想像の世界です。 slogan_3,也试试《Minecraft》!,Also try 'Minecraft'!,「Minecraft」もやってみて! slogan_4,也试试《Terraria》!,Also try 'Terraria'!,「Terraria」もやってみて! +slogan_5,也试试《Terraria》!,Also try 'Terraria'!,「Terraria」もやってみて! +slogan_6,游戏在bug上运行。,The game runs on a bug.,ゲームはバグで動作します。 +slogan_7,こんにちは!,こんにちは!,こんにちは! +slogan_7,你好!,你好!,你好! +slogan_7,Hello!,Hello!,Hello! \ No newline at end of file diff --git a/scripts/weapon/ProjectileWeapon.cs b/scripts/weapon/ProjectileWeapon.cs index fe73fd0..35d13ab 100644 --- a/scripts/weapon/ProjectileWeapon.cs +++ b/scripts/weapon/ProjectileWeapon.cs @@ -182,29 +182,29 @@ public partial class ProjectileWeapon : WeaponTemplate } } - protected override void DoFire(Node2D? owner, Vector2 enemyGlobalPosition) + protected override bool DoFire(Node2D? owner, Vector2 enemyGlobalPosition) { if (owner == null) { LogCat.LogError("owner_is_null"); - return; + return false; } if (_marker2D == null) { LogCat.LogError("marker2d_is_null"); - return; + return false; } if (GameSceneDepend.ProjectileContainer == null) { LogCat.LogError("projectile_container_is_null"); - return; + return false; } if (_spellProjectileIndexes.Count == 0) { LogCat.LogError("projectile_generate_magic_is_null"); - return; + return false; } var spellScope = GetSpellScope(); //The final spell is a projectile generator. @@ -213,7 +213,8 @@ public partial class ProjectileWeapon : WeaponTemplate var packedScene = spellProjectile.GetProjectile(); if (packedScene == null) { - return; + LogCat.LogError("projectile_scene_is_null"); + return false; } for (var i = spellScope[0]; i <= spellScope[1]; i++) { @@ -223,7 +224,11 @@ public partial class ProjectileWeapon : WeaponTemplate for (var i = 0; i < NumberOfProjectiles; i++) { var projectile = NodeUtils.InstantiatePackedScene(packedScene); - if (projectile == null) return; + if (projectile == null) + { + LogCat.LogError("projectile_is_null"); + return false; + } for (var s = spellScope[0]; s <= spellScope[1]; s++) { var spell = _spells[s]; @@ -241,5 +246,6 @@ public partial class ProjectileWeapon : WeaponTemplate var spell = _spells[i]; spell.RestoreWeapon(this); } + return true; } } \ No newline at end of file diff --git a/scripts/weapon/WeaponTemplate.cs b/scripts/weapon/WeaponTemplate.cs index 00e842a..43dd365 100644 --- a/scripts/weapon/WeaponTemplate.cs +++ b/scripts/weapon/WeaponTemplate.cs @@ -86,19 +86,19 @@ public abstract partial class WeaponTemplate : PickAbleTemplate { return; } - - if (owner is CharacterTemplate characterTemplate) + var result = DoFire(owner, enemyGlobalPosition); + if (result) { - //We check the recoil of the weapon before each firing. - //我们在每次开火之前,检查武器的后坐力。 - if (_recoilStrength != 0) + if (owner is CharacterTemplate characterTemplate) { - characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize); + if (_recoilStrength != 0) + { + characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize); + } } - } - _audioStreamPlayer2D?.Play(); - DoFire(owner, enemyGlobalPosition); + _audioStreamPlayer2D?.Play(); + } _lastFiringTime = nowTime; } @@ -106,5 +106,9 @@ public abstract partial class WeaponTemplate : PickAbleTemplate /// Execute fire /// 执行开火 /// - protected abstract void DoFire(Node2D? owner, Vector2 enemyGlobalPosition); + /// + ///Return Is the fire successful? + ///返回是否成功开火? + /// + protected abstract bool DoFire(Node2D? owner, Vector2 enemyGlobalPosition); } \ No newline at end of file