public void TestPathBetweenStartingSectors_DoubleRing4() { var target = GameMaps.LoadMap(_game, "DoubleRing4"); target.SetVisibilityToTeam(1, true); var start = target.Sectors.First(_ => _.StartingSector != 0); var mid2 = target.Sectors.Where(_ => _.StartingSector != 0).Skip(1).First(); var mid3 = target.Sectors.Where(_ => _.StartingSector != 0).Skip(2).First(); var end = target.Sectors.Last(_ => _.StartingSector != 0); var path1 = target.ShortestPath(1, start.Id, end.Id); path1.ShouldNotBeNull(); path1.Count.ShouldBe(1); var path2 = target.ShortestPath(1, start.Id, mid2.Id); path2.ShouldNotBeNull(); path2.Count.ShouldBe(1); var path3 = target.ShortestPath(1, start.Id, mid3.Id); path3.ShouldNotBeNull(); path3.Count.ShouldBe(2); }
public void Setup() { _game = new StrategyGame(); _game.SetupGame(GameSettings.Default()); _game.LoadData(); _game.Map = GameMaps.LoadMap(_game, "PinWheel2"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _sb = new SpriteBatch(_graphics.GraphicsDevice); //TEST _sbtest = new SpriteBatch(_graphics.GraphicsDevice); _fontest = Content.Load <SpriteFont>("Arial"); // TODO: use this.Content to load your game content here _font = Content.Load <SpriteFont>("Arial"); _fontsmall = Content.Load <SpriteFont>("ArialS"); _common = Content.Load <Texture2D>("common/common"); _gui = Content.Load <Texture2D>("common/guis"); _title = Content.Load <Texture2D>("common/bg"); _default = Content.Load <Texture2D>("common/default"); _loop = new GameLoop(_font, _fontsmall); //TEST if (!GameMaps.Initialize()) { Exit(); } if (!GameLoop.InitializeContent(_common, _gui, _title, _default)) { Exit(); } }
private void LoadSettings() { _game.SetupGame(_settings); _game.LoadData(); _game.Map = GameMaps.LoadMap(_game, _settings.MapName); _game.InitialiseGame(false); }
private void LoadMaps(string currentMap) { var maps = GameMaps.AvailableMaps(Settings.NumTeams); MapList.Items.Clear(); MapList.Items.AddRange(maps); MapList.Text = maps.Contains(currentMap) ? currentMap : maps[0]; }
public void Setup() { _game = new StrategyGame(); _game.SetupGame(GameSettings.Default()); _target = GameMaps.LoadMap(_game, "PinWheel2"); _target.SetVisibilityToTeam(1, true); }
public void Setup() { _settings = GameSettings.Default(); _game = new StrategyGame(); _game.SetupGame(_settings); _game.LoadData(); _game.Map = GameMaps.LoadMap(_game, _settings.MapName); }
public void TestNextWormholesWhenNotVisible() { _game.Map = GameMaps.LoadMap(_game, "Star2"); GameEntity otherEnd; var next = _game.NextWormholeEnd(1, 1, 4, out otherEnd); next.ShouldBeNull(); otherEnd.ShouldBeNull(); }
public void AvailableMaps_Restricted() { var maps = GameMaps.AvailableMaps(2, false); maps.Length.ShouldBeGreaterThan(0); maps.ShouldNotContain("Brawl2"); maps.ShouldNotContain(GameMaps.RandomMapName_Small); maps.ShouldNotContain(GameMaps.RandomMapName_Normal); maps.ShouldNotContain(GameMaps.RandomMapName_Large); }
public void Setup() { var settings = GameSettings.Default(); _game = new StrategyGame(); _game.SetupGame(settings); _game.LoadData(); _game.Map = GameMaps.LoadMap(_game, settings.MapName); _game.InitialiseGame(); }
public void Setup() { _game = new StrategyGame(); _game.SetupGame(GameSettings.Default()); _game.LoadData(); _game.Map = GameMaps.LoadMap(_game, "PinWheel2"); _target = new CommanderAI(_game, 2, Color.Red, null); }
private static void IncreaseMaxGameSessionsCount() { _maxGameSessions += 100; var resizedGameSessions = new GameSession[_maxGameSessions]; var resizedGameMaps = new GameMap[_maxGameSessions]; GameSessions.CopyTo(resizedGameSessions, 0); GameMaps.CopyTo(resizedGameMaps, 0); GameSessions = resizedGameSessions; GameMaps = resizedGameMaps; }
public void TestPathBetweenStartingSectors_Brawl() { var target = GameMaps.Brawl(_game); target.SetVisibilityToTeam(1, true); var start = target.Sectors.First(_ => _.StartingSector != 0); var end = target.Sectors.Last(_ => _.StartingSector != 0); var path = target.ShortestPath(1, start.Id, end.Id); path.ShouldBeNull(); }
public void TestPathBetweenStartingSectors_DoubleRing() { var target = GameMaps.LoadMap(_game, "DoubleRing2"); target.SetVisibilityToTeam(1, true); var start = target.Sectors.First(_ => _.StartingSector != 0); var end = target.Sectors.Last(_ => _.StartingSector != 0); var path = target.ShortestPath(1, start.Id, end.Id); path.ShouldNotBeNull(); path.Count.ShouldBe(1); }
public void TestNextWormholeBetweenStartingSectors_Star_Step2() { _game.Map = GameMaps.LoadMap(_game, "Star2"); _game.Map.SetVisibilityToTeam(1, true); GameEntity otherEnd; var next = _game.NextWormholeEnd(1, 1, 4, out otherEnd); next.ShouldNotBeNull(); otherEnd.ShouldNotBeNull(); next.SectorId.ShouldBe(1); otherEnd.SectorId.ShouldBe(2); }
public void TestNextWormholesWhenSomeVisible() { _game.Map = GameMaps.LoadMap(_game, "Star2"); _game.Map.Sectors[0].SetVisibleToTeam(0, true); _game.Map.Sectors[1].SetVisibleToTeam(0, true); _game.Map.Sectors[2].SetVisibleToTeam(0, true); GameEntity otherEnd; var next = _game.NextWormholeEnd(1, 0, 2, out otherEnd); next.ShouldNotBeNull(); otherEnd.ShouldNotBeNull(); next.SectorId.ShouldBe(0); otherEnd.SectorId.ShouldBe(1); }
public void TestPathBetweenStartingSectors_PinWheel3() { var target = GameMaps.LoadMap(_game, "PinWheel3"); target.SetVisibilityToTeam(1, true); var start = target.Sectors.First(_ => _.StartingSector != 0); var mid = target.Sectors.Where(_ => _.StartingSector != 0).Skip(1).First(); var end = target.Sectors.Last(_ => _.StartingSector != 0); var path1 = target.ShortestPath(1, start.Id, end.Id); path1.ShouldNotBeNull(); path1.Count.ShouldBe(4); var path2 = target.ShortestPath(1, start.Id, mid.Id); path2.ShouldNotBeNull(); path2.Count.ShouldBe(3); }
public static GameSettings Default() { var s = new GameSettings { NumTeams = 2, GameType = EGameType.Skirmish, MapName = GameMaps.RandomName(2, false), WormholesVisible = true, RocksVisible = false, TeamColours = new[] { DefaultTeamColours[0], DefaultTeamColours[1] }, TeamAlliance = new[] { 1, 2 }, RestrictTechToIds = new int[2][], NumPilots = 16, MaximumPilots = int.MaxValue, AiDifficulty = 3, VariantAi = true, WormholesSignatureMultiplier = 1, MinersInitial = 1, MinersMaxDrones = 4, MinersCapacityMultiplier = 1, ConstructorsMaxDrones = 1, ConstructorsMaxTowerDrones = 4, InitialCapitalMaxDrones = 2, ResourcesStartingMultiplier = 1, ResourcesPerRockMultiplier = 1, ResourcesEachTickMultiplier = 1, ResourceConversionRateMultiplier = 1, ResearchCostMultiplier = 1, ResearchTimeMultiplier = 1, RocksPerSectorTech = 2, RocksPerSectorResource = 4, RocksPerSectorGeneral = 8, RocksAllowedTech = new List <EAsteroidType> { EAsteroidType.Carbon, EAsteroidType.Silicon, EAsteroidType.Uranium }, StationHealthMultiplier = new Dictionary <EBaseType, float>(), StationSignatureMultiplier = new Dictionary <EBaseType, float>(), ShipSpeedMultiplier = new Dictionary <EShipType, float>(), ShipHealthMultiplier = new Dictionary <EShipType, float>(), ShipSignatureMultiplier = new Dictionary <EShipType, float>(), AntiShipWeaponRangeMultiplier = 1, AntiShipWeaponFireRateMultiplier = 1, AntiShipWeaponDamageMultiplier = 1, NanWeaponRangeMultiplier = 1, NanWeaponFireRateMultiplier = 1, NanWeaponHealingMultiplier = 1, AntiBaseWeaponRangeMultiplier = 1, AntiBaseWeaponFireRateMultiplier = 1, AntiBaseWeaponDamageMultiplier = 1, MissileWeaponDamageMultiplier = 1, MissileWeaponFireRateMultiplier = 1, MissileWeaponRangeMultiplier = 1, MissileWeaponSpeedMultiplier = 1, MissileWeaponTrackingMultiplier = 1, AlienChance = 0f, MinAliensPerSector = 2, MaxAliensPerSector = 4, MinAlienBasesPerSector = 1, MaxAlienBasesPerSector = 2, WaveShipsPerBase = 1, InitialWaveDelay = 45 * 4, DecreaseWaveDelay = 1 * 4, AlientWaveTargetType = EWaveTargetType.Everyone, GameSpeed = 0.5f, NormalShipCostMultiplier = 0.5f, }; s.TeamFactions = new[] { Faction.Default(s), Faction.Random(s) }; foreach (EBaseType e in Enum.GetValues(typeof(EBaseType))) { s.StationHealthMultiplier.Add(e, 1); s.StationSignatureMultiplier.Add(e, 1); } foreach (EShipType e in Enum.GetValues(typeof(EShipType))) { s.ShipSpeedMultiplier.Add(e, 1); s.ShipHealthMultiplier.Add(e, 1); s.ShipSignatureMultiplier.Add(e, 1); } return(s); }
private void RandomMap_Click(object sender, EventArgs e) { SoundEffect.Play(ESounds.mousedown); MapList.SelectedItem = GameMaps.RandomName((int)Teams.Value, false); }
private void RandomMap_Click(object sender, EventArgs e) { MapList.SelectedItem = GameMaps.RandomName((int)Teams.Value, false); }
public void ChangeArena(int selectedMap) { GameMaps prev = gameMap; gameMap = (GameMaps)selectedMap; //Debug.Log(gameMap); //Debug.Log(prev); switch (gameMap) { case GameMaps.AbandonedStation: AbandonedStation.SetActive(true); break; case GameMaps.None: switch (prev) { case GameMaps.AbandonedStation: AbandonedStation.SetActive(false); break; default: break; } break; default: break; } //Debug.Log(AbandonedStation.activeInHierarchy); }
// Update is called once per frame void Update() { if(gameStarted) { gameStarted = false; gameMap = GameMaps.AbandonedStation; //THIS NEEDS TO CHANGE ********** NOT PERMANENT!!!!!!!!!!!!!!!!!!!!!!!!! //have the host collect all the players playing players = GameObject.FindGameObjectsWithTag("Drone"); if(players.Length > 1) _playingSolo = false; //have the host place all the players around the map for(int i = 0; i < players.Length; i++) { NetworkView view = players[i].networkView; GameObject thePlayer = view.observed.gameObject; if(thePlayer.GetComponent<Player>().IsTheHost) { spawnPlayers (); } } //get the starting position for our camera for(int i = 0; i < players.Length; i++) { NetworkView view = players[i].networkView; if(view.isMine) { droneCameraPosition = players[i].transform.position; droneCameraPosition.z += 5; myCamera.transform.position = droneCameraPosition; Quaternion playerRotation = players[i].transform.rotation; myCamera.transform.rotation = playerRotation; myCamera.transform.parent = players[i].transform; players[i].AddComponent<CameraScript>(); players[i].GetComponent<Player>().IsGameStarted = true; networkView.RPC("sendMessage", RPCMode.All, view.observed.name + " camera moved"); _player = players[i]; } } //start updating gameplay material gameActive = true; } else if(gameActive) { if(!_playingSolo) { int playersStillActive = 0; for(int i = 0; i < players.Length; i++) { if(players[i].GetComponent<Player>().CanFly) { playersStillActive++; } } if(playersStillActive <= 1) { for(int i = 0; i < players.Length; i++) { if(players[i].GetComponent<Player>().IsTheHost) { GameObject server = GameObject.Find("Server_GO"); server.GetComponent<Server>().DisconnectNetwork(); } } } } } else if(gameOver) { } }