示例#1
0
    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);
        }
示例#4
0
    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);
        }
示例#6
0
 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);
         }
     }
 }
示例#7
0
 public void M_AddToModuleDict(int id, UnitModule module)
 {
     m_modules[id] = module;
 }
示例#8
0
 public bool GetModule(UnitModule module)
 {
     return(unitModules[(int)module]);
 }
示例#9
0
 public void SetModule(UnitModule module, bool value)
 {
     unitModules[(int)module] = value;
 }
示例#10
0
 public bool CanPlaceModule(UnitModule module)
 {
     return(!unitModules[(int)module]);
 }
示例#11
0
 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();
 }
示例#12
0
 public UnitController(IceFactoryUnitOfWork unitOfWork) : base(unitOfWork)
 {
     _unitModule = new UnitModule(unitOfWork);
 }
示例#13
0
 public static BuildingOperation NewModule(Building building, Unit unit, UnitModule mod)
 {
     return(new NewModule(building, unit, mod));
 }