public MainForm(Dictionary <Language, string> localization_paths, Biom[] bioms) { InitializeComponent(); InitControls(); this.bioms = bioms; current_biom = this.bioms[0]; }
internal void SetBiom(Biom selectedItem) { biom = selectedItem; textBoxBiomName.Text = biom.Name; textBoxBiomDescription.Text = biom.Description; listBoxObjects.Items.AddRange(biom.Objects); }
private void btnSaveBiom_Click(object sender, EventArgs e) { try { EventObject[] eventObjects = new EventObject[listBoxObjects.Items.Count]; for (int i = 0; i < listBoxObjects.Items.Count; i++) { eventObjects[i] = (EventObject)listBoxObjects.Items[i]; } biom = new Biom(textBoxBiomName.Text, textBoxBiomDescription.Text, eventObjects); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AktualizatorBiomówPoprawniePrzypisujeBiomy(float wilg, float temp, Biom oczekiwanyBiom) { var aktualizator = new AktualizatorBiomow(new KonfigAktualizatoraBiomow( new List<KonfiguracjaBiomu> { new KonfiguracjaBiomu(0f, 0f, Biom.Bagna), new KonfiguracjaBiomu(0f, 1f, Biom.Pustynia), new KonfiguracjaBiomu(1f, 0f, Biom.GoleGory), new KonfiguracjaBiomu(1f, 1f, Biom.Tajga) })); var k1 = _mapa.Komorki.ElementAt(0); k1.Dane.Temperatura = temp; k1.Dane.Wilgotnosc = wilg; k1.Dane.Typ = TypKomorki.Lad; aktualizator.Przetwarzaj(_mapa); k1.Dane.Biom.ShouldEqual(oczekiwanyBiom); }
void Call(Biom biom, Button button) { if (!lastSelected.Equals(button)) { int chosedIndex = PlayerPrefs.GetInt("BiomSelected", -1); int CoinsCount = PlayerPrefs.GetInt("CoinsCount", -1); if (!biom.isLocked) { if (biom.isBuyed) { if (biom.index != chosedIndex) { PlayerPrefs.SetInt("BiomSelected", biom.index); Debug.Log("Biom selected"); } } else if (CoinsCount != -1) { if (CoinsCount >= biom.prise) { biom.isBuyed = true; CoinsCount -= biom.prise; PlayerPrefs.SetInt("CoinsCount", CoinsCount); Debug.Log(string.Format("Biom buyed for {0}", biom.prise)); } else { Debug.Log("you dont have enouf money"); //TODO massage (you dont have enouf money) } } } else { Debug.Log("Biom is locked"); //TODO massage (Biom is locked) } UpdateButtonBiom(biom, button); lastSelected = button; } }
private void UpdateArray() { if (cells == null) { cells = new Biom[x, y]; return; } Biom[,] newArray = new Biom[x, y]; for (int i = 0; i < x && i < cells.GetLength(0); i++) { for (int k = 0; k < y && k < cells.GetLength(1); k++) { newArray[i, k] = cells[i, k]; } } cells = newArray; }
void UpdateButtonBiom(Biom b, Button button) { int chosedIndex = PlayerPrefs.GetInt("BiomSelected", -1); if (b.isBuyed) { button.GetComponentsInChildren <Text>(true)[1].text = ""; button.GetComponentsInChildren <Text>(true)[1].GetComponentsInChildren <Image>(true)[0].gameObject.SetActive(false); if (b.index == chosedIndex || (b.isDefault && chosedIndex == -1)) { button.GetComponentsInChildren <Image>(true)[1].gameObject.SetActive(true); button.GetComponentsInChildren <Image>(true)[1].overrideSprite = SelectedIcon; if (lastSelected != null) { lastSelected.GetComponentsInChildren <Image>(true)[1].gameObject.SetActive(false); } } else { button.GetComponentsInChildren <Image>(true)[1].gameObject.SetActive(false); } } else { button.GetComponentsInChildren <Text>(true)[1].text = b.prise.ToString(); button.GetComponentsInChildren <Text>(true)[1].GetComponentsInChildren <Image>(true)[0].gameObject.SetActive(true); if (b.isLocked) { button.GetComponentsInChildren <Image>(true)[1].gameObject.SetActive(true); button.GetComponentsInChildren <Image>(true)[1].overrideSprite = lockerIcon; } else { button.GetComponentsInChildren <Image>(true)[1].gameObject.SetActive(false); } } }
void Chose() { int selectedIndex = (PlayerPrefs.GetInt("BiomSelected", -1)); foreach (Biom b in biomsDatabase.bioms) { if (selectedIndex == -1) { if (b.isDefault) { selectedOrDefault = b; break; } } else { if (b.index == selectedIndex) { selectedOrDefault = b; break; } } } }
//____________________________ //This is a temporary class until the implementation of the Editor drafting tool //____________________________ public static Dictionary<Hex, Biom> HexDraft(Biom biom) { return new Dictionary<Hex, Biom> { { new Hex(0, 0), biom } }; }
// Use this for initialization void Start() { needToUpdate = true; currentBiom = ApplicationController.levelBuilder.GetCurrentBiom(); }
public BiomToBuild(Biom b, Quaternion rotation) { this.b = b; this.rotation = rotation; }
public List <Tile> ReadFile() { List <Tile> newTiles; if (ApplicationController.SelectedFile == null) { return(null); } string[] lines = ApplicationController.SelectedFile.text.Split('\n'); int x = 0; int y = 0; newTiles = new List <Tile> (); if (lines.Length > 0) { var line = lines [0].Split(';', ',', '\n'); switch (line [0]) { case Constants.BiomType.Asteroid: currentBiom = asteroid; break; case Constants.BiomType.Earth: currentBiom = earth; break; case Constants.BiomType.Spaceship: currentBiom = spaceship; break; default: currentBiom = earth; break; } if (!int.TryParse(line [1], out numOfCrystalsToExit)) { numOfCrystalsToExit = 0; } switch (line [2]) { case "up": ApplicationController.gravity = Vector3.up; break; case "down": ApplicationController.gravity = Vector3.down; break; case "left": ApplicationController.gravity = Vector3.left; break; case "right": ApplicationController.gravity = Vector3.right; break; default: ApplicationController.gravity = Vector3.down; break; } } var tileLines = lines.Skip(1); //skip first line foreach (var line in tileLines) { //Debug.Log(line); var symbols = line.Split(';', ','); foreach (var symbol in symbols) { // Debug.Log(symbol); if (symbol != "") { if (string.Compare(symbol[0].ToString(), Constants.TileType.Mineral) == 0) { int value; int.TryParse(new string(symbol.ToCharArray().Where(char.IsDigit).ToArray()), out value); newTiles.Add(new Tile(x, -y, symbol[0].ToString(), value)); } else { newTiles.Add(new Tile(x, -y, symbol[0].ToString())); } } x++; } y++; x = 0; } tiles = newTiles; return(newTiles); }
public HexUnit(Biom type) { Type = type; }
void AddListener(Button b, Biom value) { b.onClick.AddListener(() => Call(value, b)); }
public List <Tile> GenerateRandom() { List <Tile> freeTiles = new List <Tile> (); List <Tile> newTiles = new List <Tile> (); Tile newTile; Tile player; currentBiom = earth; ApplicationController.gravity = Vector3.down; for (int x = 1; x <= randomLevelGenerator.xMax; x++) { for (int y = 1; y <= randomLevelGenerator.yMax; y++) { if (x == 1 || x == randomLevelGenerator.xMax || y == 1 || y == randomLevelGenerator.yMax) { newTile = new Tile(x, y, Constants.TileType.Border); newTiles.Add(newTile); } else { freeTiles.Add(new Tile(x, y, " ")); } } } int index = Random.Range(0, freeTiles.Count); player = freeTiles [index]; player.tileType = Constants.TileType.Player; newTiles.Add(player); freeTiles.RemoveAt(index); if (player.y != randomLevelGenerator.yMax - 1) { newTile = freeTiles.Find(tile => tile.x == player.x && tile.y == player.y + 1); freeTiles.Remove(newTile); newTile.tileType = Constants.TileType.Ground; newTiles.Add(newTile); randomLevelGenerator.maxGround--; } while (randomLevelGenerator.maxStones > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.Stone; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxStones--; } while (randomLevelGenerator.maxGround > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.Ground; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxGround--; } while (randomLevelGenerator.maxCrystal > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.Crystal; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxCrystal--; numOfCrystalsToExit++; } while (randomLevelGenerator.maxActiveBomb > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.ActiveBomb; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxActiveBomb--; } while (randomLevelGenerator.maxDeactiveBomb > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.DeactiveBomb; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxDeactiveBomb--; } while (randomLevelGenerator.maxBallon > 0) { if (freeTiles.Count == 0) { break; } index = Random.Range(0, freeTiles.Count - 1); newTile = freeTiles [index]; newTile.tileType = Constants.TileType.Ballon; newTiles.Add(newTile); freeTiles.RemoveAt(index); randomLevelGenerator.maxBallon--; } tiles = newTiles; return(newTiles); }
public EWeather GetWeatherInBiom(Biom biom) { return(biom.Weather); }
public KonfiguracjaBiomu(float wilg, float temp, Biom biom) { Wilgotnosc = wilg; Temperatura = temp; Biom = biom; }
public void SetRoomDesc(Biom v, GameObject BluePrint, Material M) { GameObject go = (GameObject)Instantiate(BluePrint); go.transform.parent = transform; this.M = M; this.spwn = go.GetComponent<ConstraintSpawner>(); this.spwn.Desc = v; this.spwn.transform.position = this.transform.position; this.spwn.transform.localScale = this.transform.localScale; go.transform.localScale = new Vector3(go.transform.localScale.x*39, go.transform.localScale.y * 10, go.transform.localScale.z*39); go.transform.position += new Vector3(0,5,0); }