private List <bUUDataObject> initializeUnitBuildingPairObjects() { //create List of all possible building, upgrade, and units with pair details List <bUUDataObject> listToReturn = new List <bUUDataObject>(); //first add God object bUUDataObject object1 = new bUUDataObject("godBuilding", 0, 0, 0, false, false, 0, true); listToReturn.Add(object1); //pull data from building initializer foreach (Building thisBuilding in buildingList) { bUUDataObject newObject = new bUUDataObject(thisBuilding.name, thisBuilding.buildTime, thisBuilding.mineralCost, thisBuilding.gasCost, thisBuilding.isProductionBuilding, false, thisBuilding.supplyProvided, true); listToReturn.Add(newObject); } //pull data from upgrade initializer foreach (Upgrade thisUpgrade in upgradePackage.allUpgrades) { bUUDataObject newObject = new bUUDataObject(thisUpgrade.name, thisUpgrade.buildTime, thisUpgrade.mineralCost, thisUpgrade.gasCost, false, false, thisUpgrade.producedOutOf, thisUpgrade.techReqs, 0); listToReturn.Add(newObject); } //need a unique object for each instance of a unit foreach (Unit thisUnit in unitList) { for (int i = 0; i < thisUnit.numToBuild; i++) { string name = thisUnit.name + i.ToString(); bUUDataObject newObject = new bUUDataObject(name, thisUnit.buildTime, thisUnit.buildTimeWithWG, thisUnit.mineralCost, thisUnit.gasCost, false, true, thisUnit.productionBuilding, thisUnit.highestTechBuildingList, thisUnit.supply); listToReturn.Add(newObject); } } //add in probe object and warpgate object(since number of probes will be set at 0) Unit probeStats = unitList.First(x => x.name.Equals("Probe")); bUUDataObject probeObject = new bUUDataObject(probeStats.name, probeStats.buildTime, probeStats.mineralCost, probeStats.gasCost, false, true, probeStats.productionBuilding, probeStats.highestTechBuildingList, probeStats.supply); listToReturn.Add(probeObject); Unit wGStats = unitList.First(x => x.name.Equals("warpGate")); bUUDataObject wGObject = new bUUDataObject(wGStats.name, wGStats.buildTime, wGStats.mineralCost, wGStats.gasCost, false, true, wGStats.productionBuilding, wGStats.highestTechBuildingList, wGStats.supply); listToReturn.Add(wGObject); //give each item an ID for (int i = 0; i < listToReturn.Count(); i++) { listToReturn[i].bUUDataID = i; } return(listToReturn); }
private void createNewVersions(List <bUUEvent> myEventList, List <PairsTable> myPairList, List <bUUDataObject> myPairObjectLibrary) { eventList = new List <bUUEvent>(); pairList = new List <PairsTable>(); pairObjectLibrary = new List <bUUDataObject>(); foreach (bUUEvent thisEvent in myEventList) { bUUEvent newEvent = new bUUEvent(thisEvent.bUUEventID, thisEvent.startTime, thisEvent.endTime, thisEvent.bUUDataID, thisEvent.pairAsChildID, thisEvent.pairAsParentID); eventList.Add(newEvent); } foreach (PairsTable thisPair in myPairList) { PairsTable newPair = new PairsTable(thisPair.pairID, thisPair.parentBUUEventID, thisPair.childBUUEventID); pairList.Add(newPair); } foreach (bUUDataObject thisObject in myPairObjectLibrary) { bUUDataObject newObject = new bUUDataObject(thisObject.bUUDataID, thisObject.bUUEventIDForPrimaryBuilding, thisObject.name, thisObject.duration, thisObject.durationWithwarpGateResearch, thisObject.mineralCost, thisObject.gasCost, thisObject.isProductionBuilding, thisObject.isUnit, thisObject.isBuilding, thisObject.producedOutOf, thisObject.buildingReqList, thisObject.supplyCost, thisObject.supplyProvided); pairObjectLibrary.Add(newObject); } }
private void addSecondaryBuildings() { //go through lastBasketEntries foreach (IDWithList thisRow in lastBasketEntries) { //only consider entries after the first one for (int i = 1; i < thisRow.IDList.Count; i++) { //add secondary building before this event //find event production building to add correct secondary building int childEventID = thisRow.IDList[i]; bUUDataObject B1 = pairObjectLibrary[thisRow.ID]; //need to create a new object that copies B1, but with new ID bUUDataObject newObject = new bUUDataObject(B1.name, B1.duration, B1.mineralCost, B1.gasCost, B1.isProductionBuilding, B1.isUnit, B1.supplyProvided, B1.isBuilding); int dataID = pairObjectLibrary.Count(); newObject.bUUDataID = dataID; pairObjectLibrary.Add(newObject); //create new event int eventID = eventList.Count(); double endTime = eventList[childEventID].startTime; double duration = B1.duration; bUUEvent newEvent = new bUUEvent(eventID, endTime - duration, endTime, dataID, pairList.Count() + 1, pairList.Count()); eventList.Add(newEvent); //create new pair PairsTable newPair = new PairsTable(pairList.Count(), eventID, childEventID); pairList.Add(newPair); //also need to create pair connected secondaryBuilding to its parent //first find parent int parentOfSecondaryBuildingEventID = pairList[eventList[pairObjectLibrary[thisRow.ID].bUUEventIDForPrimaryBuilding].pairAsChildID].parentBUUEventID; PairsTable newPair2 = new PairsTable(pairList.Count(), parentOfSecondaryBuildingEventID, eventID); pairList.Add(newPair2); //parentEvent will not have relationship added for this pair (only has space to show one relationship currently) //update event PairAsChildID of child eventList[childEventID].pairAsChildID = pairList.Count() - 2; } } }
public bUUPairObject(bUUDataObject myParent, bUUDataObject myChild) { parent = myParent; child = myChild; isChildFromWarpGate = false; }
public bUUPairObject(bUUDataObject myParent, bUUDataObject myChild, bool myIsChildFromWarpGate) { parent = myParent; child = myChild; isChildFromWarpGate = myIsChildFromWarpGate; }