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); } }
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)); }
void Awake() { if (instance != null) { Debug.LogError("More than one MegaCollector in scene !"); return; } instance = this; InvokeRepeating("UpdateCollectTargets", 0f, 0.5f); }