7
7
import com .github .kuangcp .tank .domain .Hero ;
8
8
import com .github .kuangcp .tank .domain .Hinder ;
9
9
import com .github .kuangcp .tank .domain .Iron ;
10
+ import com .github .kuangcp .tank .domain .StageBorder ;
10
11
import com .github .kuangcp .tank .domain .Tank ;
12
+ import com .github .kuangcp .tank .resource .AvatarImgMgr ;
11
13
import com .github .kuangcp .tank .resource .DefeatImgMgr ;
12
14
import com .github .kuangcp .tank .resource .VictoryImgMgr ;
13
15
import com .github .kuangcp .tank .util .ExecutePool ;
@@ -60,18 +62,16 @@ public class PlayStageMgr {
60
62
public static volatile boolean newStage = true ;
61
63
public static volatile boolean invokeNewStage = false ;
62
64
63
- // 场景 上下文
64
- // public List<EnemyTank> enemyTanks;
65
- // public List<Brick> bricks; // 砖
66
- // public List<Iron> irons; // 铁
67
-
68
65
public Map <Integer , Hero > heroMap = new ConcurrentHashMap <>();
69
66
70
67
public static List <EnemyTank > enemyList ;
71
68
// todo 转移
72
69
public static List <Brick > bricks ;
73
70
public static List <Iron > irons ;
74
71
72
+ public StageBorder border = null ;
73
+
74
+
75
75
//所有按下键的code集合
76
76
public static int [][] enemyTankMap = new int [12 ][2 ];
77
77
public static int [] myself = new int [6 ];
@@ -98,6 +98,12 @@ public void markStartLogic() {
98
98
*/
99
99
public static void init (Hero hero , List <EnemyTank > enemyTanks , List <Brick > bricks , List <Iron > irons ) {
100
100
instance = new PlayStageMgr (hero , enemyTanks , bricks , irons );
101
+
102
+ instance .border = new StageBorder (20 , 740 , 20 , 540 );
103
+ instance .border .setHomeX (380 );
104
+ instance .border .setHomeY (480 );
105
+ instance .border .setHomeW (AvatarImgMgr .instance .width );
106
+ instance .border .setHomeH (AvatarImgMgr .instance .height );
101
107
}
102
108
103
109
private PlayStageMgr (Hero hero , List <EnemyTank > enemyTanks , List <Brick > bricks , List <Iron > irons ) {
@@ -347,13 +353,13 @@ public boolean willInBorder(Tank tank) {
347
353
}
348
354
switch (tank .direct ) {
349
355
case DirectType .UP :
350
- return tank .y - tank .getHalfHeight () - tank .getSpeed () > RoundMapMgr . instance . border .getMinY ();
356
+ return tank .y - tank .getHalfHeight () - tank .getSpeed () > border .getMinY ();
351
357
case DirectType .DOWN :
352
- return tank .y + tank .getHalfHeight () + tank .getSpeed () < RoundMapMgr . instance . border .getMaxY ();
358
+ return tank .y + tank .getHalfHeight () + tank .getSpeed () < border .getMaxY ();
353
359
case DirectType .LEFT :
354
- return tank .x - tank .getHalfHeight () - tank .getSpeed () > RoundMapMgr . instance . border .getMinX ();
360
+ return tank .x - tank .getHalfHeight () - tank .getSpeed () > border .getMinX ();
355
361
case DirectType .RIGHT :
356
- return tank .x + tank .getHalfHeight () + tank .getSpeed () < RoundMapMgr . instance . border .getMaxX ();
362
+ return tank .x + tank .getHalfHeight () + tank .getSpeed () < border .getMaxX ();
357
363
}
358
364
return false ;
359
365
}
@@ -362,8 +368,8 @@ public boolean willInBorder(Bullet bullet) {
362
368
if (Objects .isNull (bullet )) {
363
369
return false ;
364
370
}
365
- return bullet .x <= RoundMapMgr . instance . border .getMinX () || bullet .x >= RoundMapMgr . instance . border .getMaxX ()
366
- || bullet .y <= RoundMapMgr . instance . border .getMinY () || bullet .y >= RoundMapMgr . instance . border .getMaxY ();
371
+ return bullet .x <= border .getMinX () || bullet .x >= border .getMaxX ()
372
+ || bullet .y <= border .getMinY () || bullet .y >= border .getMaxY ();
367
373
}
368
374
369
375
public static void setEnemySize (int enemySize ) {
0 commit comments