Skip to content

Commit

Permalink
fix: 🐛 BulletBomb
Browse files Browse the repository at this point in the history
  • Loading branch information
panxuc committed Mar 30, 2024
1 parent e42d0d6 commit ee236ae
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions logic/Gaming/AttackManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,32 @@ namespace Gaming
public partial class Game
{
private readonly AttackManager attackManager;
private class AttackManager(Map gameMap, ShipManager shipManager)
private class AttackManager
{
private readonly Map gameMap = gameMap;
private readonly ShipManager shipManager = shipManager;
public readonly MoveEngine moveEngine = new(
private readonly Map gameMap;
private readonly ShipManager shipManager;
private readonly MoveEngine moveEngine;
public AttackManager(Map gameMap, ShipManager shipManager)
{
this.gameMap = gameMap;
this.shipManager = shipManager;
moveEngine = new(
gameMap: gameMap,
OnCollision: (obj, collisionObj, moveVec) => MoveEngine.AfterCollision.Destroyed,
EndMove: obj => obj.CanMove.SetROri(false)
OnCollision: (obj, collisionObj, moveVec) =>
{
BulletBomb((Bullet)obj, (GameObj)collisionObj);
return MoveEngine.AfterCollision.Destroyed;
},
EndMove: obj =>
{
if (obj.CanMove)
{
BulletBomb((Bullet)obj, null);
}
obj.CanMove.SetROri(false);
}
);

}
public void ProduceBulletNaturally(BulletType bulletType, Ship ship, double angle, XY pos)
{
// 子弹如果没有和其他物体碰撞,将会一直向前直到超出人物的attackRange
Expand Down

0 comments on commit ee236ae

Please sign in to comment.