public void M_SaveUnitToFile(string unitName, UnitModule unitModuleToSave) { SavedModule unitToSave = SaveSubModules(unitModuleToSave); string jsonString = JsonUtility.ToJson(unitToSave); SaveToFile(unitName, jsonString); }
void initializeModule() { //get data from the resource acquired from the server to build the module ... //this function should be called when the data fetch is ready ... //this is a json result ... unit = JsonUtility.FromJson <UnitModule>(webReqs.data_result); _VRScreenManager.showTitle(unit); }
public void processPreviousUnitContent(UnitModule unit) { if (GlobalProgressIndex < 0) { return; } string property = unit.unitcontent.unit_progress[--GlobalProgressIndex]; var value = unit.unitcontent.GetType().GetField(property).GetValue(unit.unitcontent); publishUnit(value, property, -1); }
SavedModule SaveSubModules(UnitModule currentModule) { SavedModule moduleToSave = new SavedModule(); moduleToSave.moduleType = currentModule.m_moduleType.ToString(); foreach (UnitSubModule module in currentModule.m_modules.Values) { SavedModule subModule = SaveSubModules(module); subModule.attachedToIndex = module.m_attachedToIndex; moduleToSave.modules.Add(subModule); } return(moduleToSave); }
public void processNextUnitContent(UnitModule unit) { //it means we are done ... if ((unit.unitcontent.unit_progress.Length - 1) <= GlobalProgressIndex) { return; } string property = unit.unitcontent.unit_progress[GlobalProgressIndex++]; var value = unit.unitcontent.GetType().GetField(property).GetValue(unit.unitcontent); publishUnit(value, property); }
private void M_AttachTo(ModuleHardpoint attachTo) { m_attachedTo = attachTo.m_moduleTopObject.GetComponent <UnitModule>(); ModuleHardpoint[] hardpoints = GetComponentsInChildren <ModuleHardpoint>(); foreach (ModuleHardpoint hardpoint in hardpoints) { if (hardpoint.attachesTo) { m_attachedToIndex = attachTo.m_hardpointIndex; transform.parent = attachTo.m_moduleTopObject.transform; transform.position = attachTo.transform.position; transform.localPosition -= hardpoint.transform.localPosition; transform.rotation = attachTo.transform.rotation; hardpoint.attachesTo = attachTo; // Why? Remove? attachTo.m_moduleTopObject.GetComponent <UnitModule>().M_AddToModuleDict(this.GetInstanceID(), this); } } }
public void M_AddToModuleDict(int id, UnitModule module) { m_modules[id] = module; }
public bool GetModule(UnitModule module) { return(unitModules[(int)module]); }
public void SetModule(UnitModule module, bool value) { unitModules[(int)module] = value; }
public bool CanPlaceModule(UnitModule module) { return(!unitModules[(int)module]); }
public NewModule(Building building, Unit unit, UnitModule module) : base(needDone, type, new ResourceTotality(new int[] { 5, 0, 0, 0 }), startEnergyCostumation, building) { this.unit = unit; this.module = module; StartOperation(); }
public UnitController(IceFactoryUnitOfWork unitOfWork) : base(unitOfWork) { _unitModule = new UnitModule(unitOfWork); }
public static BuildingOperation NewModule(Building building, Unit unit, UnitModule mod) { return(new NewModule(building, unit, mod)); }