コード例 #1
0
    public void SetupSavedMegaStructuresData(MegaStructuresData megaStructuresData)
    {
        PlanetaryShield ps = planetaryShield.GetComponent <PlanetaryShield>();
        MegaCollector   mc = megaCollector.GetComponent <MegaCollector>();
        DysonSphere     ds = dysonSphere.GetComponent <DysonSphere>();

        Debug.Log("SetupSavedMegaStructuresData | PlanetaryShield unlocked [" + ps.isUnlocked + "] | MegaCollector unlocked [" + mc.isUnlocked + "] | DysonSphere unlocked [" + ds.isUnlocked + "]");

        ps.isUnlocked = megaStructuresData.shieldUnlocked;
        if (ps.isUnlocked)
        {
            //ps.Initialize();
            ps.ReceiveSettings(megaStructuresData.shieldRadius, megaStructuresData.shieldPower, PlanetaryShield.ViewMode.Full);
        }

        mc.isUnlocked = megaStructuresData.collectorUnlocked;
        if (mc.isUnlocked)
        {
            //mc.Initialize();
            mc.BuildCollectionPoints();
            mc.Configure(megaStructuresData.collectionSpeed, megaStructuresData.collectionPointsNb);
        }


        ds.isUnlocked = megaStructuresData.dysonSphereUnlocked;
        if (ds.isUnlocked)
        {
            //ds.Initialize();
            ds.Configure(megaStructuresData.dysonSphereStructurePoints, megaStructuresData.dysonSphereAutoRepair);
        }
    }
コード例 #2
0
    public MegaStructuresData BuildMegaStructuresData()
    {
        PlanetaryShield ps = planetaryShield.GetComponent <PlanetaryShield>();
        MegaCollector   mc = megaCollector.GetComponent <MegaCollector>();
        DysonSphere     ds = dysonSphere.GetComponent <DysonSphere>();

        return(new MegaStructuresData(ps.enabled, ps.radius, ps.damagePower, mc.isUnlocked, mc.currentCollectionPointNb, mc.currentCollectionSpeed, ds.isUnlocked, ds.currentStructurePoints, ds.currentAutoRepairState));
    }
コード例 #3
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one PlanetaryShield in scene !"); return;
     }
     instance = this;
 }