diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs
index 4f68013..cdffdd6 100644
--- a/DungeonShooting_Godot/src/game/GameApplication.cs
+++ b/DungeonShooting_Godot/src/game/GameApplication.cs
@@ -108,7 +108,6 @@
//固定帧率
Engine.MaxFps = 60;
//调试绘制开关
- Debug = true;
ActivityObject.IsDebug = Debug;
//Engine.TimeScale = 0.2f;
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
index 73cbf62..5108ee2 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
@@ -31,6 +31,7 @@
private bool _init = false;
+ private AffiliationArea _affiliationArea;
private float _hitRadius;
private int _minHarm;
private int _maxHarm;
@@ -51,13 +52,14 @@
///
/// 初始化爆炸数据
///
+ /// 爆炸所在区域
/// 攻击的层级
/// 伤害半径
/// 最小伤害
/// 最大伤害
/// 击退半径
/// 最大击退速度
- public void Init(uint attackLayer, float hitRadius, int minHarm, int maxHarm, float repelledRadius, float maxRepelled)
+ public void Init(AffiliationArea affiliationArea, uint attackLayer, float hitRadius, int minHarm, int maxHarm, float repelledRadius, float maxRepelled)
{
if (!_init)
{
@@ -68,7 +70,8 @@
AnimationPlayer.AnimationFinished += OnAnimationFinish;
BodyEntered += OnBodyEntered;
}
-
+
+ _affiliationArea = affiliationArea;
AttackLayer = attackLayer;
_hitRadius = hitRadius;
_minHarm = minHarm;
@@ -77,6 +80,8 @@
_maxRepelled = maxRepelled;
CollisionMask = attackLayer | PhysicsLayer.Prop | PhysicsLayer.Throwing | PhysicsLayer.Debris;
CircleShape.Radius = Mathf.Max(hitRadius, maxRepelled);
+
+ Check();
}
public void RunPlay()
@@ -85,6 +90,17 @@
AnimationPlayer.Play(AnimatorNames.Play);
}
+ public void Check()
+ {
+ var position = Position;
+ var freezeSprites = _affiliationArea.RoomInfo.StaticSprite.CollisionCircle(position, _repelledRadius, true);
+ foreach (var freezeSprite in freezeSprites)
+ {
+ var temp = freezeSprite.Position - position;
+ freezeSprite.ActivityObject.MoveController.AddForce(temp.Normalized() * _maxRepelled * (_repelledRadius - temp.Length()) / _repelledRadius);
+ }
+ }
+
public void OnReclaim()
{
GetParent().RemoveChild(this);
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
index f44c553..72aacb1 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
@@ -137,7 +137,7 @@
explode.Position = Position;
explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360);
explode.AddToActivityRoot(RoomLayerEnum.YSortLayer);
- explode.Init(AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
+ explode.Init(TriggerRole.AffiliationArea, AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
explode.RunPlay();
}
@@ -191,7 +191,7 @@
explode.Position = Position;
explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360);
explode.AddToActivityRootDeferred(RoomLayerEnum.YSortLayer);
- explode.Init(AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
+ explode.Init(TriggerRole.AffiliationArea, AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
explode.RunPlay();
}
diff --git a/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs b/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs
index 4e975ee..2043dd4 100644
--- a/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs
+++ b/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs
@@ -2,6 +2,9 @@
using System.Collections;
using Godot;
+///
+/// 敌人死亡碎片
+///
[Tool]
public partial class EnemyDebris : ActivityObject
{
@@ -30,6 +33,8 @@
yield return new WaitForSeconds(Utils.Random.RandomRangeFloat(1f, 2.5f));
gpuParticles2D.Emitting = false;
yield return new WaitForSeconds(1);
- BecomesStaticImage();
+ //BecomesStaticImage();
+ MoveController.SetAllVelocity(Vector2.Zero);
+ Freeze();
}
}
\ No newline at end of file