reset resources for real each level loading
This commit is contained in:
parent
f0323e0389
commit
6778880d5f
@ -21,13 +21,23 @@ public class ResourceManager : Singleton<ResourceManager>
|
|||||||
public ResourceManager()
|
public ResourceManager()
|
||||||
{
|
{
|
||||||
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(InitializeResources);
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(InitializeResources);
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Attach(ResetResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ResetResources()
|
||||||
|
{
|
||||||
|
_rockAmount = 0;
|
||||||
|
_woodAmount = 0;
|
||||||
|
_foodAmount = 0;
|
||||||
|
_currentPopulation = 0;
|
||||||
|
_maximumPopulation = 0;
|
||||||
|
}
|
||||||
private void InitializeResources(Level level)
|
private void InitializeResources(Level level)
|
||||||
{
|
{
|
||||||
RockAmount = level.StartRock;
|
RockAmount = level.StartRock;
|
||||||
WoodAmount = level.StartWood;
|
WoodAmount = level.StartWood;
|
||||||
FoodAmount = level.StartFood;
|
FoodAmount = level.StartFood;
|
||||||
|
CurrentPopulation = 0;
|
||||||
MaximumPopulation = level.StartPopulation;
|
MaximumPopulation = level.StartPopulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user