public void Init(IInitContext context, Settings.Master settings, Settings.Size windowSize) { this.windowSize = windowSize; var scene = context.ObjectPool.GetObject <BattleScene>(); var sceneSettings = settings.Battles[0]; scene.Init(context, sceneSettings, settings.Enemies, settings.Weapons.FromNames(sceneSettings.WeaponNames), windowSize); CurrentScene = scene; }
public void Init(IInitContext context, Settings.Battle settings, Settings.Enemies enemiesSettings, Settings.Weapon[] weaponsSettings, Settings.Size windowSize) { base.Init(new Point(windowSize.Width, windowSize.Height)); initContext = context; this.settings = settings; this.weaponsSettings = weaponsSettings; Health = settings.Health; Amount = settings.Amount; WeaponPods = new WeaponPod[settings.WeaponPlaces.Length]; for (int i = 0; i < settings.WeaponPlaces.Length; i++) { var setting = settings.WeaponPlaces[i]; var wp = context.ObjectPool.GetObject <WeaponPod>(); wp.Init(setting); WeaponPods[i] = wp; } Waves = new EnemyWave[settings.Waves.Length]; for (int i = 0; i < settings.Waves.Length; i++) { var setting = settings.Waves[i]; var wave = context.ObjectPool.GetObject <EnemyWave>(); wave.Init(context, setting, enemiesSettings, settings.Paths); Waves[i] = wave; } changeStatusSubscription = context.Dispatcher.Subscribe <ChangeStatusMessage>(OnChangeStatus); Status = BattleSceneStatus.Active; }