public void InitializePhysics(GraphicsDevice graphics, ContentManager Content) { // Catching Viewport dimensions ViewportWidth = graphics.Viewport.Width; ViewportHeight = graphics.Viewport.Height; if (Penumbra == null) { Penumbra = new PenumbraComponent(graphics, Content); } // Our world for the physics body _World = new World(Vector2.Zero); // Unit conversion rule to get the right position data between simulation space and display space ConvertUnits.SetDisplayUnitToSimUnitRatio(MeterInPixels); // Initialize the physics debug view PhysicsDebugView = new DebugViewXNA(_World); PhysicsDebugView.LoadContent(graphics, Content); PhysicsDebugView.RemoveFlags(DebugViewFlags.Controllers); PhysicsDebugView.RemoveFlags(DebugViewFlags.Joint); PhysicsDebugView.RemoveFlags(DebugViewFlags.Shape); PhysicsDebugView.DefaultShapeColor = new Color(255, 255, 0); }
public override void Draw(GameTime gameTime) { PenumbraComponent Penumbra = Game.Services.GetService <PenumbraComponent>(); Penumbra.BeginDraw(); if (_tileSheet == null) { return; } SpriteBatch sp = Game.Services.GetService <SpriteBatch>(); // Draw the tiles sp.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Camera.CurrentCameraTranslation); // Draw the Tiles foreach (Tile t in Tiles) { Vector2 position = new Vector2(t.X * t.TileWidth, t.Y * t.TileHeight); sp.Draw(_tileSheet, new Rectangle(position.ToPoint(), new Point(t.TileWidth, t.TileHeight)), new Rectangle(t.TileRef._sheetPosX * t.TileWidth, t.TileRef._sheetPosY * t.TileHeight, t.TileWidth, t.TileHeight), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0f); } sp.End(); Penumbra.Draw(gameTime); base.Draw(gameTime); }
public override void Activate(PenumbraComponent penumbra, ContentManager content) { _isRadiusIncreasing = true; _progress = 0; _light = new PointLight { Position = new Vector2(-100, 0), Color = Color.White, Intensity = 1.5f, Scale = new Vector2(1200), Radius = MinLightRadius }; penumbra.Lights.Add(_light); var hullVertices = new[] { new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, -0.5f), new Vector2(-0.5f, -0.5f) }; penumbra.Hulls.Add(new Hull(hullVertices) { Position = new Vector2(100, 0), Scale = new Vector2(50f) }); }
public override void Activate(PenumbraComponent penumbra, ContentManager content) { _light = new PointLight { Position = new Vector2(-150, 0), Color = Color.White, Scale = new Vector2(700), Radius = 20 }; penumbra.Lights.Add(_light); _hull1 = new Hull(new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, -0.5f), new Vector2(-0.5f, -0.5f)) { Position = HullPos1, Scale = new Vector2(90f) }; _hull2 = new Hull(new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, -0.5f), new Vector2(-0.5f, -0.5f)) { Position = HullPos2, Scale = new Vector2(70f) }; _hull3 = new Hull(new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, -0.5f), new Vector2(-0.5f, -0.5f)) { Position = HullPos3, Scale = new Vector2(80f) }; penumbra.Hulls.Add(_hull1); penumbra.Hulls.Add(_hull2); penumbra.Hulls.Add(_hull3); }
public override void Activate(PenumbraComponent penumbra, ContentManager content) { _light = new PointLight { Position = new Vector2(-100, 0), Color = Color.White, Scale = new Vector2(600), Radius = 20 }; penumbra.Lights.Add(_light); Vector2[] hullVertices = { new Vector2(0, 50), new Vector2(14, 20), new Vector2(47, 15), new Vector2(23, -7), new Vector2(29, -40), new Vector2(0, -25), new Vector2(-29, -40), new Vector2(-24, -7), new Vector2(-47, 15), new Vector2(-14, 20), }; penumbra.Hulls.Add(new Hull(hullVertices) { Position = new Vector2(0, 0), }); }
public override void Activate(PenumbraComponent penumbra, ContentManager content) { _hulls.Clear(); _lights.Clear(); _lights.Add(new Spotlight { Color = Color.YellowGreen, Scale = new Vector2(400), Radius = 20, ConeDecay = 1.5f }); _lights.Add(new Spotlight { Color = Color.Wheat, Scale = new Vector2(1000), Rotation = MathHelper.Pi - MathHelper.PiOver2 * 0.75f, ConeDecay = 0.5f }); _lights.Add(new Spotlight { Color = Color.Turquoise, Scale = new Vector2(900), Rotation = MathHelper.Pi + MathHelper.PiOver2 * 0.75f, ConeDecay = 1f }); _lights.ForEach(penumbra.Lights.Add); GenerateHulls(penumbra); }
public TilePlayer(Game game, Vector2 startPosition, List <TileRef> sheetRefs, int frameWidth, int frameHeight, float layerDepth, SoundEffect tankHumSound, SoundEffect tankTrackSound, SoundEffect tankWarningSound, SoundEffect heartBeatSound) : base(game, startPosition, sheetRefs, frameWidth, frameHeight, layerDepth, tankHumSound, tankTrackSound) { Health = MAX_HEALTH; DrawOrder = 45; OrbLight.Color = Color.LightCyan; healthBar = new HealthBar(game, PixelPosition); AddHealthBar(healthBar); PenumbraComponent penumbra = Game.Services.GetService <PenumbraComponent>(); penumbra.Lights.Add(HeadLights); this.heartBeatSound = heartBeatSound; this.tankWarningSound = tankWarningSound; heartBeatSoundInstance = heartBeatSound.CreateInstance(); heartBeatSoundInstance.Volume = 1.0f; heartBeatSoundInstance.IsLooped = true; tankWarningSoundInstance = tankWarningSound.CreateInstance(); tankWarningSoundInstance.Volume = 0.1f; tankWarningSoundInstance.IsLooped = true; }
public Tank(Game game, Vector2 userPosition, List <TileRef> sheetRefs, int frameWidth, int frameHeight, float layerDepth, SoundEffect tankHumSound, SoundEffect tankTrackSound) : base(game, userPosition, sheetRefs, frameWidth, frameHeight, layerDepth) { DrawOrder = 30; #region Tank Audio TankHumSound = tankHumSound; TankTrackSound = tankTrackSound; HumSoundInstance = TankHumSound.CreateInstance(); HumSoundInstance.Volume = 0.05f; HumSoundInstance.Pitch = -1f; HumSoundInstance.IsLooped = true; HumSoundInstance.Play(); TrackSoundInstance = TankTrackSound.CreateInstance(); TrackSoundInstance.Volume = 0f; TrackSoundInstance.IsLooped = true; TrackSoundInstance.Play(); #endregion //AddHealthBar(healthBar); PenumbraComponent penumbra = Game.Services.GetService <PenumbraComponent>(); penumbra.Lights.Add(OrbLight); }
public SandboxGame() { var deviceManager = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; _penumbra = new PenumbraComponent(this) { SpriteBatchTransformEnabled = false, AmbientColor = Color.Black }; Components.Add(_penumbra); _penumbraController = new PenumbraControllerComponent(this, _penumbra); Components.Add(_penumbraController); Scenarios = new ScenariosComponent(this, _penumbra, _penumbraController); Components.Add(Scenarios); var ui = new UIComponent(this, _penumbraController) { DrawOrder = int.MaxValue }; Components.Add(ui); _camera = new CameraMovementComponent(this); Components.Add(_camera); Components.Add(new FpsGarbageComponent(this)); // There's a bug when trying to change resolution during window resize. // https://github.com/mono/MonoGame/issues/3572 deviceManager.PreferredBackBufferWidth = 1280; deviceManager.PreferredBackBufferHeight = 720; Window.AllowUserResizing = false; IsMouseVisible = true; }
public override void Activate(PenumbraComponent penumbra, ContentManager content) { _state = State.MovingInward; _progress = 0; penumbra.Lights.Add(new PointLight { Position = new Vector2(0, -100), Color = Color.White, Scale = new Vector2(600), Radius = 20 }); Vector2[] hullVertices = { new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, -0.5f), new Vector2(-0.5f, -0.5f) }; _hull1 = new Hull(hullVertices) { Position = new Vector2(0, 0), Scale = new Vector2(50f) }; _hull2 = new Hull(hullVertices) { Position = new Vector2(0, 0), Scale = new Vector2(50f) }; penumbra.Hulls.Add(_hull1); penumbra.Hulls.Add(_hull2); }
public Lights(PenumbraComponent penumbra, Enums enums) { this.penumbra = penumbra; this.enums = enums; penumbra.Lights.Add(light); penumbra.Hulls.Add(hull); }
public void Initialize() { Console.WriteLine("GameManager - Initialize"); Penumbra = new PenumbraComponent(Game1.Game) { AmbientColor = new Color(50, 50, 50, 255) }; Game1.Game.Services.AddService(Penumbra); ParticleManager = new ParticleManager(); SoundManager = new SoundManager(); ItemManager = new ItemManager(); CreatureManager = new CreatureManager(); ProjectileManager = new ProjectileManager(); ScreenManager = new ScreenManager(); Managers = new List <IManager> { ParticleManager, SoundManager, ItemManager, CreatureManager, ProjectileManager, ScreenManager }; Managers.ForEach(x => x.Initialize()); Penumbra.Initialize(); }
public Projectile(Game game, string ParentName, Vector2 projectilePosition, List <TileRef> sheetRefs, int frameWidth, int frameHeight, float layerDepth, Vector2 direction, int speed, SoundEffect sndShoot, SoundEffect sndPierce) : base(game, projectilePosition, sheetRefs, frameWidth, frameHeight, layerDepth) { Parent = ParentName; Target = Vector2.Zero; Direction = direction; DrawOrder = 50; StartPosition = projectilePosition; _sndShoot = sndShoot; _sndPierce = sndPierce; Velocity = speed; PenumbraComponent penumbra = Game.Services.GetService <PenumbraComponent>(); penumbra.Lights.Add(OrbLight); OrbLight.Enabled = false; explosionSprite = new BulletExplosion(Game, this.PixelPosition, new List <TileRef>() { new TileRef(0, 7, 0), new TileRef(1, 7, 0), new TileRef(2, 7, 0), new TileRef(3, 7, 0), new TileRef(4, 7, 0), new TileRef(5, 7, 0), new TileRef(6, 7, 0), new TileRef(7, 7, 0) }, 64, 64, 0f); }
/// <summary> /// Constructs a new level. /// </summary> /// <param name="serviceProvider"> /// The service provider that will be used to construct a ContentManager. /// </param> /// <param name="fileStream"> /// A stream containing the tile data. /// </param> public Level(IServiceProvider serviceProvider, Stream fileStream, int levelIndex) { // Create a new content manager to load content used just by this level. content = new ContentManager(serviceProvider, "Content"); // Get ahold of the lighting system and reset it. penumbra = (PenumbraComponent)serviceProvider.GetService(typeof(PenumbraComponent)); penumbra.Hulls.Clear(); penumbra.Lights.Clear(); timeRemaining = TimeSpan.FromMinutes(2.0); LoadTiles(fileStream); // Load background layer textures. For now, all levels must // use the same backgrounds and only use the left-most part of them. layers = new Texture2D[3]; for (int i = 0; i < layers.Length; ++i) { // Choose a random segment if each background layer for level variety. int segmentIndex = levelIndex; layers[i] = Content.Load <Texture2D>("Backgrounds/Layer" + i + "_" + segmentIndex); } // Load sounds. exitReachedSound = Content.Load <SoundEffect>("Sounds/ExitReached"); }
public PlatformerGame() { Instance = this; graphics = new GraphicsDeviceManager(this) { PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8 }; #region Lighting penumbra = new PenumbraComponent(Instance) { AmbientColor = Color.DarkGray, Debug = false }; penumbra.Lights.Clear(); penumbra.Hulls.Clear(); #endregion rand = new Random(); Content.RootDirectory = "Content"; SetApplicationSettings(); net = new NetworkClient(); player = new Player(true); map = new Map(); if (settings.EditorMode) { settings.multiplayer = false; multiplayer = false; } }
public void InitLighting() { Penumbra = new PenumbraComponent(ThisGame); ThisGame.Services.AddService(Penumbra); Penumbra.Initialize(); Penumbra.AmbientColor = Color.Black; }
protected override void Initialize() { /* int Dimension =GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - 100; * _graphics.PreferredBackBufferHeight = Dimension; * _graphics.PreferredBackBufferWidth = Dimension; * _graphics.IsFullScreen = true; * _graphics.ApplyChanges();*/ IsMouseVisible = true; //Window.AllowUserResizing = true; Screen = Window; Penumbra = new PenumbraComponent(this); Components.Add(Penumbra); Penumbra.AmbientColor = Color.White; TextureManager.InitInstance(Content); PartieDuJeu = new IPartieDeJeu[5]; PartieDuJeu[(int)TypesDePartieDeJeu.MenuDefaut] = new MenuDefaut(); PartieDuJeu[(int)TypesDePartieDeJeu.Jeu] = new JeuMenu(); //PartieDuJeu[(int)TypesDePartieDeJeu.Armurerie] = new Armurerie(); SoundManager.InitInstance(Content); seiTrameJeu = SoundManager.TrameSonoreMenu.CreateInstance(); seiTrameJeu.Play(); base.Initialize(); }
public GameRoot() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = _width; graphics.PreferredBackBufferHeight = _height; //graphics.PreferMultiSampling = false; graphics.SynchronizeWithVerticalRetrace = true; //graphics.IsFullScreen = true; graphics.ApplyChanges(); IsMouseVisible = false; IsFixedTimeStep = true; Window.Title = "Steel Wrath"; Window.AllowAltF4 = false; Content.RootDirectory = "Content"; penumbra = new PenumbraComponent(this) { //AmbientColor = new Color(new Vector3(WORLD_BRIGHTNESS)) // NO HUE //AmbientColor = new Color(22, 30, 38) // LIGHT GRAY BLUE AmbientColor = new Color(15, 27, 38) // DARKER GRAY BLUE //AmbientColor = new Color(26, 15, 38) // PURPLE }; Components.Add(penumbra); Services.AddService(penumbra); }
public MenuState(Game game) : base(game) { log = LogManager.GetLogger(nameof(MenuState)); log.Info("Adding menu service"); Game.Services.AddService(typeof(IMenuState), this); penumbra = new PenumbraComponent(GameReference) { AmbientColor = Color.Gray }; log.Debug("Adding staff light"); staffLight = new PointLight { Scale = new Vector2(staffLightIntensity), Position = new Vector2(413, 375), Color = Color.Yellow }; log.Debug("Adding door light"); doorLight = new PointLight() { Scale = new Vector2(250), Position = new Vector2(213, 248), Color = Color.Yellow }; penumbra.Lights.Add(staffLight); penumbra.Lights.Add(doorLight); }
public FarseerMagic() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Create the lighting system penumbra = new PenumbraComponent(this); }
public TimeService(GameServiceContainer services) { _services = services; _penumbra = _services.GetService <PenumbraComponent>(); CurrentTime = new DateTime(); CurrentTime = CurrentTime.AddHours(12); }
public Map(Game game, bool useLightingSystem = true) { if (useLightingSystem) { //create krypton, link to this game, use shaders Penumbra = new PenumbraComponent(game); this.InitializeMapLight(); } }
public TankExplosion(Game game, Vector2 userPosition, List <TileRef> sheetRefs, int frameWidth, int frameHeight, float layerDepth) : base(game, userPosition, sheetRefs, frameWidth, frameHeight, layerDepth) { DrawOrder = 101; PenumbraComponent penumbra = Game.Services.GetService <PenumbraComponent>(); penumbra.Lights.Add(OrbLight); }
private void DeathCam(TilePlayer player) { PenumbraComponent Penumbra = Game.Services.GetService <PenumbraComponent>(); Zoom += ZOOM_SPEED * (ZOOM_SPEED * 2); CamPos += new Vector2(Zoom * 2, Zoom * 2); Penumbra.Lights.Clear(); Penumbra.Hulls.Clear(); }
public Game1() { enums = new Enums(); graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; enums.gState = GameState.Menu; penumbra = new PenumbraComponent(this); Components.Add(penumbra); lights = new Lights(penumbra, enums); }
public Game_Screen(World _world, GameCamera _camera, PenumbraComponent _lighting, Particle_World _particle_world, Physics_Engine _physics_engine, Lua _lua, GraphicsDevice _device, string _id) : base(_id) { world = _world; camera = _camera; lighting = _lighting; particle_world = _particle_world; physics_engine = _physics_engine; lua = _lua; device = _device; }
public Game1() { this.IsMouseVisible = true; graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; penumbra = new PenumbraComponent(this); Components.Add(penumbra); penumbra.AmbientColor = Color.Black; }
public HelloPenumbraUWP() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Create the lighting system and add sample light and hull. penumbra = new PenumbraComponent(this); penumbra.Lights.Add(light); penumbra.Hulls.Add(hull); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; _penumbra = new PenumbraComponent(this); //_penumbra.SpriteBatchTransformEnabled = false; this.Components.Add(_penumbra); }
public Menu_Screen(Screen_Manager _manager, PenumbraComponent _penumbra, GameCamera _camera) : base("Menu") { camera = _camera; manager = _manager; penumbra = _penumbra; //new OKore_Parser(); //sky = new Sky_Renderer(Assets.It.Get<Texture2D>("sky_1"), true); rect = Assets.It.Get <Texture2D>("gui-rect"); font = Assets.It.Get <SpriteFont>("gfont"); }