Recoil is calculated only after successful firing.
仅在成功开火后计算后座力。
This commit is contained in:
parent
e718d78137
commit
407798b13b
|
@ -114,3 +114,5 @@ log_exit_the_screen,退出屏幕。,Exit screen,画面を終了します。
|
||||||
log_failed_to_create_room_preview,创建{0}的房间预览图失败。,Failed to create a room preview of the {0}.,{0}の部屋のプレビューを作成できませんでした。
|
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_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.,射出体を提供するスペルを装填していません。
|
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.,射出シーンは空です。
|
|
|
@ -4,3 +4,8 @@ slogan_1,Kawaii!,Kawaii!,Kawaii!
|
||||||
slogan_2,魔法是想象的世界。,Magic is an imaginary world.,魔法は想像の世界です。
|
slogan_2,魔法是想象的世界。,Magic is an imaginary world.,魔法は想像の世界です。
|
||||||
slogan_3,也试试《Minecraft》!,Also try 'Minecraft'!,「Minecraft」もやってみて!
|
slogan_3,也试试《Minecraft》!,Also try 'Minecraft'!,「Minecraft」もやってみて!
|
||||||
slogan_4,也试试《Terraria》!,Also try 'Terraria'!,「Terraria」もやってみて!
|
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!
|
|
|
@ -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)
|
if (owner == null)
|
||||||
{
|
{
|
||||||
LogCat.LogError("owner_is_null");
|
LogCat.LogError("owner_is_null");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_marker2D == null)
|
if (_marker2D == null)
|
||||||
{
|
{
|
||||||
LogCat.LogError("marker2d_is_null");
|
LogCat.LogError("marker2d_is_null");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameSceneDepend.ProjectileContainer == null)
|
if (GameSceneDepend.ProjectileContainer == null)
|
||||||
{
|
{
|
||||||
LogCat.LogError("projectile_container_is_null");
|
LogCat.LogError("projectile_container_is_null");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (_spellProjectileIndexes.Count == 0)
|
if (_spellProjectileIndexes.Count == 0)
|
||||||
{
|
{
|
||||||
LogCat.LogError("projectile_generate_magic_is_null");
|
LogCat.LogError("projectile_generate_magic_is_null");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
var spellScope = GetSpellScope();
|
var spellScope = GetSpellScope();
|
||||||
//The final spell is a projectile generator.
|
//The final spell is a projectile generator.
|
||||||
|
@ -213,7 +213,8 @@ public partial class ProjectileWeapon : WeaponTemplate
|
||||||
var packedScene = spellProjectile.GetProjectile();
|
var packedScene = spellProjectile.GetProjectile();
|
||||||
if (packedScene == null)
|
if (packedScene == null)
|
||||||
{
|
{
|
||||||
return;
|
LogCat.LogError("projectile_scene_is_null");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
for (var i = spellScope[0]; i <= spellScope[1]; i++)
|
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++)
|
for (var i = 0; i < NumberOfProjectiles; i++)
|
||||||
{
|
{
|
||||||
var projectile = NodeUtils.InstantiatePackedScene<Projectile>(packedScene);
|
var projectile = NodeUtils.InstantiatePackedScene<Projectile>(packedScene);
|
||||||
if (projectile == null) return;
|
if (projectile == null)
|
||||||
|
{
|
||||||
|
LogCat.LogError("projectile_is_null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (var s = spellScope[0]; s <= spellScope[1]; s++)
|
for (var s = spellScope[0]; s <= spellScope[1]; s++)
|
||||||
{
|
{
|
||||||
var spell = _spells[s];
|
var spell = _spells[s];
|
||||||
|
@ -241,5 +246,6 @@ public partial class ProjectileWeapon : WeaponTemplate
|
||||||
var spell = _spells[i];
|
var spell = _spells[i];
|
||||||
spell.RestoreWeapon(this);
|
spell.RestoreWeapon(this);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -86,19 +86,19 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var result = DoFire(owner, enemyGlobalPosition);
|
||||||
if (owner is CharacterTemplate characterTemplate)
|
if (result)
|
||||||
{
|
{
|
||||||
//We check the recoil of the weapon before each firing.
|
if (owner is CharacterTemplate characterTemplate)
|
||||||
//我们在每次开火之前,检查武器的后坐力。
|
|
||||||
if (_recoilStrength != 0)
|
|
||||||
{
|
{
|
||||||
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
if (_recoilStrength != 0)
|
||||||
|
{
|
||||||
|
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_audioStreamPlayer2D?.Play();
|
_audioStreamPlayer2D?.Play();
|
||||||
DoFire(owner, enemyGlobalPosition);
|
}
|
||||||
_lastFiringTime = nowTime;
|
_lastFiringTime = nowTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,5 +106,9 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
/// <para>Execute fire</para>
|
/// <para>Execute fire</para>
|
||||||
/// <para>执行开火</para>
|
/// <para>执行开火</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void DoFire(Node2D? owner, Vector2 enemyGlobalPosition);
|
/// <returns>
|
||||||
|
///<para>Return Is the fire successful?</para>
|
||||||
|
///<para>返回是否成功开火?</para>
|
||||||
|
/// </returns>
|
||||||
|
protected abstract bool DoFire(Node2D? owner, Vector2 enemyGlobalPosition);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user