Closed Daniel-Martinez closed 10 years ago
Created a singleton class that includes a List object. Copy everything from Target factory list into this new list. When an enemy if fired upon the Status "At Large" is replaced with "Dead" If the Operator tries to fire at the target a second time a message is displayed that this target is already Dead.
singleton tempObj = singleton.getInstance(); //creating a singlton object to keep track of out target list with status of whos dead and whos at large
List<target> statusList = tempObj.getList();
statusList = targetList;
/*****************************************************************/
for (i = 0; i < targetList.Count; i++) //iterate through our TargetList to search for target name if enteredValue is entered.
{
if (statusList[i].Name == enteredValue)
{
statusList[i].Status = "Dead";
}
}
Figure out how to create a singleton class that has a type List to hold target data. This list should be able to keep track if a target has been fired upon and killed.