public void Load(string heroName, GameManager gm, Func <Hero, GameState, AbstractGameLevel> worldLoader) { gm.Context.NodeHeroPlacedAfterLoad = null; //reset context gm.Context.Hero = null; gm.Context.CurrentNode = null; var hero = gm.Persister.LoadHero(heroName); var allies = gm.Persister.LoadAllies(heroName); gm.AlliesManager.SetEntities(allies.Allies); var gs = gm.Persister.LoadGameState(heroName); gm.SetGameState(gs); AbstractGameLevel node = null; node = worldLoader(hero, gs); gm.SetLoadedContext(node, hero); //gm.SetContext(node, hero, GameContextSwitchKind.GameLoaded); gm.PrintHeroStats("load"); }
protected Hero AddHero(AbstractGameLevel node) { var hero = Container.GetInstance <Hero>(); var empOnes = node.GetEmptyTiles(nodeIndexMustMatch: false); var empty = empOnes.First(); node.SetTile(hero, empty.point); return(hero); }
public AbstractGameObject() { level = LevelManager.CurrentLevel; }
public static void SetLevel(string Key) { currentLevel = levels[Key]; }
public static void RegisterLevel(string Key, AbstractGameLevel Level) { levels[Key] = Level; }