/* Creates a map based on the current width, height, and type values */ private void createMap() { // If type is not valid, then the map is not created if ( SceneTransitionStorage.containsType(map_type) && map_width >= 0 && map_height >= 0) { if ( Map != null ) { Map.removeHexes(); } Map = new MapManager(map_width, map_height, map_type, false); Map.generatePseudoRandomMap(); } }
// Use this for initialization void Start() { // Initialize hand display GameObject[] card_frames = GameObject.FindGameObjectsWithTag("Hand"); hand_display = new HandScript[DeckManager.MAX_HAND_SIZE]; for (int idx = 0; idx < card_frames.Length; ++idx) { hand_display[idx] = card_frames[idx].GetComponent<HandScript>(); } musicSlider = GameObject.Find ("Slider"); UI.GetComponentInChildren<Canvas> ().enabled = false; shopCanvas.enabled = false; units = new List<UnitScript>(); // give starting deck specifications DeckManager d1 = new DeckManager( new CardScript.CardType[] {CardScript.CardType.Currency1, CardScript.CardType.Currency2, CardScript.CardType.HumanInfantry, CardScript.CardType.HumanTank}, new int[] {7, 2, 2, 1} ); DeckManager d2 = new DeckManager( new CardScript.CardType[] {CardScript.CardType.Currency1, CardScript.CardType.Currency2, CardScript.CardType.AlienInfantry, CardScript.CardType.AlienTank}, new int[] {7, 2, 2, 1} ); // player setup Player1 = new PlayerScript(d1); Player2 = new PlayerScript(d2); Player1.getDeck().deck.shuffle(); Player2.getDeck().deck.shuffle(); turn = 1; getPlayer().getDeck().deal(); drawCards(); Map = new MapManager(SceneTransitionStorage.map_width, SceneTransitionStorage.map_height, SceneTransitionStorage.map_type, SceneTransitionStorage.fog); // map setup Map.generatePseudoRandomMap(); // place alien base turn = 2; HexScript hex = Map.hex_at_offset_from(Map.map[0][0], false, false, System.Math.Min(Map.width / 2, Map.height / 2)); p2Base = placeUnit ( UnitScript.Types.A_Base, (int)hex.position.x, (int)hex.position.y ); //int unit = 4; // place one of each unit /*for (int adj_idx = 0; adj_idx < 6; ++adj_idx) { HexScript adj_hex = Map.adjacentHexTo(hex, adj_idx); if (adj_hex != null && adj_hex.getOccupied() == 0) { placeUnit((UnitScript.Types)unit, (int)adj_hex.position.x, (int)adj_hex.position.y ); ++unit; } if (unit > 7) { break; } }*/ turn = 1; if (Map.FOG_OF_WAR) { Map.fog_of_war(true); } // place human base hex = Map.hex_at_offset_from(Map.map[Map.width - 1][Map.height - 1], false, false, System.Math.Min(Map.width / 2, Map.height / 2)); p1Base = placeUnit ( UnitScript.Types.H_Base, (int)hex.position.x, (int)hex.position.y ); // place one of each unit /*unit = 0; for (int adj_idx = 0; adj_idx < 6; ++adj_idx) { HexScript adj_hex = Map.adjacentHexTo(hex, adj_idx); if (adj_hex != null && adj_hex.getOccupied() == 0) { placeUnit((UnitScript.Types)unit, (int)adj_hex.position.x, (int)adj_hex.position.y ); ++unit; } if (unit > 3) { break; } }*/ }