public EntityFactory(AssetCache assetCache) { Rand = new Random(); Cache = assetCache; MainAtlas = assetCache.Get <Atlas>("Atlas.json"); if (MainAtlas == null) { MainAtlas = assetCache.LoadAtlas("Atlas.json"); } LaserAsset = MainAtlas.GetFrame("laser.png"); LaserVerticalAsset = MainAtlas.GetFrame("laservertical.png"); BulletAsset = MainAtlas.GetFrame("bullet.png"); EnemyShot = MainAtlas.GetFrame("enemy_shot.png"); LaserSound = assetCache.LoadSound("laserfire.wav"); ExplodeSounds = new List <Sound>() { assetCache.Get <Sound>("explosion0.wav"), assetCache.Get <Sound>("explosion1.wav"), assetCache.Get <Sound>("explosion2.wav"), }; }
public CombatState(EntityFactory factory) { DefaultFont = AssetCache.Get <Font>("DefaultFont.fnt"); MainAtlas = AssetCache.Get <Atlas>("Atlas.json"); Factory = factory; Spawner = new WaveSpawner(factory); TransformOrder = new List <Func <Entity> >() { Factory.CreateStartingPlayer, Factory.CreateRank1Fighter, Factory.CreateBomber, Factory.CreateHovercraft, }; CreateUI(); SpawnPlayer(); }
public void RequestRenderable(string uri, RenderableRequestEventHandler requestCallback) { assetCache.Get(uri, (entry) => requestCallback(entry.GetAssetClone())); }