Skip to content

Commit

Permalink
Fix #5 - Don't re-apply levels at each scene changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Aug 7, 2017
1 parent 9862b58 commit b1ecf2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CustomBarnKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Start()

log(customGameVariables.ToString());

GameEvents.onLevelWasLoaded.Add(data => LoadUpgradesPrices());
GameEvents.onLevelWasLoaded.Add(LoadUpgradesPrices);
}
}

Expand All @@ -40,7 +40,7 @@ public void Update()
}

// With the help of NoMoreGrind code by nlight
private void LoadUpgradesPrices()
private void LoadUpgradesPrices(GameScenes data)
{
log("Loading new upgrades prices");

Expand Down Expand Up @@ -88,7 +88,6 @@ private void LoadUpgradesPrices()
if (levelsVisual.Length == levels)
{
//log(facility.name + " Copying level " + (levelsVisual[i] - 1) + " for level " + (i + 1));
//level.facilityPrefab = Instantiate(upgradeLevels[levelsVisual[i] - 1].facilityPrefab);
level.facilityPrefab = upgradeLevels[levelsVisual[i] - 1].facilityPrefab;
}
else
Expand All @@ -103,6 +102,7 @@ private void LoadUpgradesPrices()
facility.SetupLevels();
facility.setLevel(facility.FacilityLevel);
}
GameEvents.onLevelWasLoaded.Remove(LoadUpgradesPrices);
//log("New upgrades prices are Loaded");
}

Expand Down

0 comments on commit b1ecf2d

Please sign in to comment.