/* * Checks for wormhole potential at grid position */ private void CheckForces(int i, int j) { int index = ConvertCoordinatesToIndex(i, j); if (i > 0 && i < fieldSize.X - 1) { Vector2 forceLeft = field[index - 1]; Vector2 forceRight = field[index + 1]; if (forceLeft.Length() > wormholeThreshold && forceRight.Length() > wormholeThreshold) { Vector2 position = ConvertFieldToScreenPos(i, j); if (forceLeft.X < 0 && forceRight.X > 0) { //Add outward wormhole WormholeManager.Add(position, false, display); } else if (forceLeft.X > 0 && forceRight.X < 0) { //Add inward wormhole WormholeManager.Add(position, true, display); } } } }
protected override void Initialize() { ScreenManager.Initialize(this, graphics.GraphicsDevice); ContentManager.Initialize(this); EventManager.Initialize(); GridManager.Initialize(10); Audio.Initialize(); server = new Server(); worldManager = new WorldManager(this); worldManager.DrawOrder = 1; Components.Add(worldManager); resourceManager = new ResourceManager(this, worldManager); resourceManager.DrawOrder = 2; Components.Add(resourceManager); wormholeManager = new WormholeManager(this); wormholeManager.DrawOrder = 3; Components.Add(wormholeManager); collectorManager = new CollectorManager(this); collectorManager.DrawOrder = 4; Components.Add(collectorManager); enemyManager = new EnemyManager(this); enemyManager.DrawOrder = 5; Components.Add(enemyManager); userManager = new UserManager(this); userManager.DrawOrder = 6; Components.Add(userManager); TeamColour.Initialize(); VLine.Effect = new BasicEffect(GraphicsDevice); beautyPass = ContentManager.Shader("BeautyRender"); noiseTexture = Content.Load <Texture2D>(@"images/noise"); beautyPass.CurrentTechnique = beautyPass.Techniques["Pretty"]; beautyPass.Parameters["TextureSize"].SetValue(ScreenManager.window); beautyPass.Parameters["NoiseMap"].SetValue(noiseTexture); oldState = Keyboard.GetState(); spriteBatch = new SpriteBatch(GraphicsDevice); for (int i = 0; i < 4; i++) { tmpTargets[i] = new RenderTarget2D(ScreenManager.graphics, 1280, 800, false, ScreenManager.graphics.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 8, RenderTargetUsage.PreserveContents); } base.Initialize(); }
public override void Update() { if (DateTime.Now > expiry) { one.Collapse(); two.Collapse(); dying = true; if (DateTime.Now > expiry.AddSeconds(2)) { WormholeManager.Remove(this); } } one.Update(); two.Update(); }
public WormholeManager(Game game) : base(game) { WormholeManager.instance = this; }
protected void CheckWormholes() { WormholeManager.Suck(this); }