-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aehmttw
committed
Mar 26, 2022
1 parent
9b23361
commit 595307d
Showing
31 changed files
with
443 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package tanks.event; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import tanks.Game; | ||
import tanks.tank.Explosion; | ||
import tanks.tank.Mine; | ||
import tanks.tank.Tank; | ||
|
||
public class EventExplosion extends PersonalEvent | ||
{ | ||
public int tank; | ||
public double posX; | ||
public double posY; | ||
public double radius; | ||
public boolean destroysObstacles; | ||
|
||
public EventExplosion() | ||
{ | ||
|
||
} | ||
|
||
public EventExplosion(Explosion e) | ||
{ | ||
this.tank = e.tank.networkID; | ||
this.posX = e.posX; | ||
this.posY = e.posY; | ||
this.radius = e.radius; | ||
this.destroysObstacles = e.destroysObstacles; | ||
} | ||
|
||
@Override | ||
public void execute() | ||
{ | ||
if (clientID == null) | ||
{ | ||
Tank t = Tank.idMap.get(tank); | ||
|
||
if (tank == -1) | ||
t = Game.dummyTank; | ||
|
||
if (t == null) | ||
return; | ||
|
||
Explosion e = new Explosion(this.posX, this.posY, this.radius, 0, destroysObstacles, t); | ||
e.explode(); | ||
} | ||
} | ||
|
||
@Override | ||
public void write(ByteBuf b) | ||
{ | ||
b.writeInt(this.tank); | ||
b.writeDouble(this.posX); | ||
b.writeDouble(this.posY); | ||
b.writeDouble(this.radius); | ||
b.writeBoolean(this.destroysObstacles); | ||
} | ||
|
||
@Override | ||
public void read(ByteBuf b) | ||
{ | ||
this.tank = b.readInt(); | ||
this.posX = b.readDouble(); | ||
this.posY = b.readDouble(); | ||
this.radius = b.readDouble(); | ||
this.destroysObstacles = b.readBoolean(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.