Example #1
0
 public void Initialize(StationData data)
 {
     Initialize();
     stationData     = data;
     hardPoints      = stationData.designData.Hull.GetHardPoints();
     unitMeshObject  = transform.GetChild(0).gameObject;
     currentMaterial = GetComponentInChildren <Renderer>().material;
     shipMaterial    = currentMaterial;
     if (stationData.GetJammingCount() > 0 && stationData.GetJammingRange() > 0 && stationData.GetJammingDelay() > 0)
     {
         hasJamming   = true;
         JammingTimer = stationData.GetJammingDelay();
     }
     hasPointDefense    = stationData.hasPointDefense();
     unitWingsComponent = new UnitWingsParentComponent(this, data);
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        if (HardPointsSources.Length > 0)
        {
            Directory.CreateDirectory(Application.dataPath + "/ShipHardPoints");
            foreach (GameObject source in HardPointsSources)
            {
                HardPoints hardPoints = source.GetComponent <HardPoints>();
                if (hardPoints != null)
                {
                    HardPointsStored hardPointsStored = new HardPointsStored(hardPoints);

                    string        path   = Application.dataPath + "/ShipHardPoints/" + source.name + ".xml";
                    XmlSerializer Writer = new XmlSerializer(typeof(HardPointsStored));
                    FileStream    file   = File.Create(path);
                    Writer.Serialize(file, hardPointsStored);
                    file.Close();
                }
            }
        }
    }