From d9dc3c5b1c7e7d2f7a0e658888fd66e9a4cad044 Mon Sep 17 00:00:00 2001 From: tbavl <tbavl@MSI.ern.nps.edu> Date: Mon, 9 Sep 2024 13:37:44 -0700 Subject: [PATCH] Bavlsik Assignment 3 update --- .../Bavlsik/BavlsikSimulationProgram.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java b/assignments/src/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java index 639f00e31e..40456bebdf 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java @@ -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 -- GitLab