public StandardShipModelRenderer() { _rasterizerState = new RasterizerState(); var content = ServiceLocator.Instance.GetService<Microsoft.Xna.Framework.Content.ContentManager>(); _rasterizerState = RasterizerState.CullNone; _device = ServiceLocator.Instance.GetService<GraphicsDevice>(); _batch = ServiceLocator.Instance.GetService<FastSpriteBatch>(); _effect = new BasicEffect(_device); _effect.TextureEnabled = true; _effect.VertexColorEnabled = true; if (ExperimentalLighting) { _effect.LightingEnabled = true; _effect.DirectionalLight0.Direction = new Vector3(-100, 100, -100); _effect.DirectionalLight0.DiffuseColor = Vector3.Zero; _effect.DirectionalLight0.SpecularColor = new Vector3(255, 255, 220) * 0.01f; _effect.AmbientLightColor = new Vector3(0.7f); //_effect.DiffuseColor = new Vector3(0.2f); _effect.DirectionalLight0.Enabled = true; } }
protected override void LoadContent() { Content.RootDirectory = Path.GetFullPath(Settings.DataFolder); Environment.CurrentDirectory = Path.GetFullPath(Settings.DataFolder); FastSpriteBatch = new FastSpriteBatch(GraphicsDevice); Services.AddService(FastSpriteBatch); Services.AddService(Content); Timer = new TimerService(); Services.AddService<ITimerService>(Timer); Coroutines = new CoroutineService(); Services.AddService<ICoroutineService>(Coroutines); Services.AddService(GraphicsDevice); SpriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(SpriteBatch); Keyboard = new KeyboardService(Coroutines); Services.AddService<IKeyboardService>(Keyboard); Services.AddService(Window); Mouse = new MouseService(Coroutines); Services.AddService<IMouseService>(Mouse); Services.AddService<IAnimationService>(new AnimationService(Coroutines, Timer)); Gui = new GuiService(); Services.AddService<IGuiService>(Gui); SpriteManager = new SpriteManagerService(Content); Services.AddService<ISpriteManagerService>(SpriteManager); ShapeManager = new ShapeManagerService(); Services.AddService<IShapeManagerService>(ShapeManager); Services.AddService(new SpaceBackgroundGeneratorService()); GalaxyGenerator = new GalaxyGeneratorService(); var testShips = new[] { "Ships/Jaeger.json", "Ships/Scimitar.json" } .Select(s => Persistence.LoadFromFile<Game.Ships.Ship>(s)) .ToList(); Game.Space.Star.LoadStellarClasses(); Galaxy = GalaxyGenerator.CreateGalaxy(); //ShipRefitScene = new ShipRefitScene(testShips); //ShipRefitScene.LoadContent(); MainMenuScene = new MainMenuScene(); MainMenuScene.LoadContent(); SystemMapScene = new SystemMapScene(Galaxy.StarSystems[0]); SystemMapScene.LoadContent(); //CurrentScene = MainMenuScene; //CurrentScene = SystemMapScene; MainGameScene = new MainGameScene(); MainGameScene.LoadContent(); CurrentScene = MainGameScene; CombatEntityFactory.LoadWeapons(); CombatEntityFactory.LoadProjectiles(); base.LoadContent(); }
public override void LoadContent() { var content = ServiceLocator.Instance.GetService<Microsoft.Xna.Framework.Content.ContentManager>(); _dustTexture = content.Load<Texture2D>("Textures/dust"); _batch = ServiceLocator.Instance.GetService<FastSpriteBatch>(); }