Skip to content
Snippets Groups Projects
Commit d9dc3c5b authored by tbavl's avatar tbavl
Browse files

Bavlsik Assignment 3 update

parent 17cd6221
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,10 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
* This program runs a simulation that initializes two entities, of which one will
* attempt to find and destroy the other, and one which will flee the other entity.
* Default program initialization includes PDU recording turned on by default.
* This program runs a simulation that initializes two entities, of which one
* will attempt to find and destroy the other, and one which will flee the other
* entity. Default program initialization includes PDU recording turned on by
* default.
*
* @see
* <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt" target="_blank">ExampleSimulationProgramLog.txt</a>
......@@ -37,7 +38,6 @@ import java.util.logging.Logger;
public class BavlsikSimulationProgram {
/* **************************** infrastructure code, modification is seldom needed ************************* */
private String descriptor = this.getClass().getSimpleName();
/**
* DIS channel defined by network address/port combination includes multiple
......@@ -99,6 +99,15 @@ public class BavlsikSimulationProgram {
*/
protected MunitionDescriptor munitionDescriptor1;
/**
* DetonationPdu for entity 1 first weapon
*/
protected DetonationPdu detPdu_1a;
/**
* DetonationPdu for entity 1 second weapon
*/
protected DetonationPdu detPdu_1b;
// hey programmer, what other state do you want? this is a good place to declare it...
/**
* Constructor to create an instance of this class. Design goal: additional
......@@ -195,6 +204,10 @@ public class BavlsikSimulationProgram {
firePdu_1b = pduFactory.makeFirePdu();
munitionDescriptor1 = new MunitionDescriptor();
detPdu_1a = pduFactory.makeDetonationPdu();
detPdu_1b = pduFactory.makeDetonationPdu();
detPdu_1a.setSourceEntityID(entityID_1);
// Your model setup: define participants. who's who in this zoo?
// Assuming you keep track of entity objects... here is some support for for Entity 1.
// PDU objects are already declared and instances created, so now set their values.
......@@ -229,6 +242,7 @@ public class BavlsikSimulationProgram {
// more is needed here by scenario authors...
munitionDescriptor1.setQuantity(1);
firePdu_1a.setDescriptor(munitionDescriptor1).setRange(3.0f);
}
/**
......@@ -350,10 +364,9 @@ public class BavlsikSimulationProgram {
} // end of simulation loop, continue until done
// ===================================================================================================// ===================================================================================================// ===================================================================================================// ===================================================================================================
if(simulationComplete){
if (simulationComplete) {
System.out.println("Good guys sank the bads guys!");
}
else{
} else {
System.out.println("Bad guys got away... we'll get em' next time boys.");
}
narrativeMessage2 = "runSimulation() completed successfully"; // all done, so tell everyone else on the channel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment