public override void LoadContent(ContentManager content) { _game = new ChainReactGame(false, true); if (ResourceManager.SoundAvailable) { var sound = ResourceManager.GetResource <Sound>("ExplosionSound"); var effect = new SoundEffect(sound); ResourceManager.ImportResource("ExplosionSoundEffect", effect); } _players = GameSettings.Instance.Players; _gameAreaTexture = ColorTextureConverter.CreateTextureFromColor(64, 64, Color.Gray); var fullWabeSizeX = ChainReactGame.WabeSize * _game.GameMap.Wabes.GetLength(0); var fullWabeSizeY = ChainReactGame.WabeSize * _game.GameMap.Wabes.GetLength(1); var fieldSize = (int)((ChainReactGame.WabeSize) / 3); _wabeBorder = TextureUtilities.CreateBorderFromColor(64, 64, 1, Color.Olive); _gameBorder = TextureUtilities.CreateBorderFromColor((int)fullWabeSizeX, (int)fullWabeSizeY, 3, Color.White); _fieldBorder = TextureUtilities.CreateBorderFromColor(fieldSize, fieldSize, 1, Color.Black); _background = ResourceManager.GetResource <Texture2D>("Background"); _font = ResourceManager.GetResource <SpriteFont>("DefaultFont"); _game.Initialize(_players); }
public Map(ChainReactGame game, bool skipAnimation, bool output) { Wabes = new Wabe[6, 6]; for (var x = 0; x <= 5; x++) { for (var y = 0; y <= 5; y++) { WabeType type; if (x == 0 && y == 0 || x == Wabes.GetLength(0) - 1 && y == 0 || x == 0 && y == Wabes.GetLength(1) - 1 || x == Wabes.GetLength(0) - 1 && y == Wabes.GetLength(1) - 1) { type = WabeType.TwoWabe; } else if (x == 0 || y == 0 || x == Wabes.GetLength(0) - 1 || y == Wabes.GetLength(1) - 1) { type = WabeType.ThreeWabe; } else { type = WabeType.FourWabe; } Wabes[x, y] = new Wabe(game, type, x, y, ChainReactGame.WabeSize, skipAnimation); } } }
public void MapSerialize() { try { var chainReactGame = new ChainReactGame(true, false); var serialized = chainReactGame.GameMap.Serialize(); var deserialized = Map.Deserialize(serialized); Console.WriteLine(deserialized.GetHashString()); } catch (Exception ex) { Debug.Write(ex); Debug.Fail(ex.Message); } }
public void MapSerialize() { try { var chainReactGame = new ChainReactGame(true, false); var serialized = chainReactGame.GameMap.Serialize(); var deserialized = Map.Deserialize(serialized); Console.WriteLine(deserialized.GetHashString()); } catch (Exception ex) { Debug.Write(ex); Debug.Fail(ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="Wabe"/> class. /// </summary> /// <param name="game">The game instance.</param> /// <param name="type">The wabe type.</param> /// <param name="x">The x position.</param> /// <param name="y">The y position.</param> /// <param name="size">The size of the wabe (Size, ScalingFactor).</param> /// <param name="resourceName">The resource name of the explosion sound</param> public Wabe(ChainReactGame game, WabeType type, int x, int y, float size, bool skipExplodeAnimation) { _skipAnimation = skipExplodeAnimation; _game = game; Type = type; Fields = new WabeField[9]; X = x; Y = y; Layout = new WabeLayout(this, new Vector2(0, 5)); switch (Type) { case WabeType.FourWabe: SphereCount = 4; for (var i = 0; i <= 8; i++) { Fields[i] = new WabeField(Layout.Fields[i], i); } break; case WabeType.ThreeWabe: SphereCount = 3; for (var i = 0; i <= 8; i++) { Fields[i] = new WabeField(Layout.Fields[i], i); } break; case WabeType.TwoWabe: SphereCount = 2; for (var i = 0; i <= 8; i++) { Fields[i] = new WabeField(Layout.Fields[i], i); } break; } _size = size; var sound = ResourceManager.TryGetResource <SoundEffect>("ExplosionSoundEffect"); AnimationManager = new ExplosionManager(new List <Explosion>(), 3, sound) { AbsolutePosition = GetPositionOfWabeCenter(), IsRelative = true }; PopulateExplosionManager(); }
private void ResetGame() { _players = GameSettings.Instance.Players; _game = new ChainReactGame(false, false); _game.Initialize(_players); }
public override void LoadContent(ContentManager content) { _game = new ChainReactGame(false, true); if (ResourceManager.SoundAvailable) { var sound = ResourceManager.GetResource<Sound>("ExplosionSound"); var effect = new SoundEffect(sound); ResourceManager.ImportResource("ExplosionSoundEffect", effect); } _players = GameSettings.Instance.Players; _gameAreaTexture = ColorTextureConverter.CreateTextureFromColor(64, 64, Color.Gray); var fullWabeSizeX = ChainReactGame.WabeSize * _game.GameMap.Wabes.GetLength(0); var fullWabeSizeY = ChainReactGame.WabeSize * _game.GameMap.Wabes.GetLength(1); var fieldSize = (int)((ChainReactGame.WabeSize) / 3); _wabeBorder = TextureUtilities.CreateBorderFromColor(64, 64, 1, Color.Olive); _gameBorder = TextureUtilities.CreateBorderFromColor((int)fullWabeSizeX, (int)fullWabeSizeY, 3, Color.White); _fieldBorder = TextureUtilities.CreateBorderFromColor(fieldSize, fieldSize, 1, Color.Black); _background = ResourceManager.GetResource<Texture2D>("Background"); _font = ResourceManager.GetResource<SpriteFont>("DefaultFont"); _game.Initialize(_players); }
private void ResetGame() { _players = GameSettings.Instance.Players; _game = new ChainReactGame(false, false); _game.Initialize(_players); }