private void setTyping(int id) { type1.sprite = typeToImage(PokemonDatabase.getPokemonbyID(id).getType1()); if (PokemonDatabase.getPokemonbyID(id).getType2() == PokemonData.Type.NONE) { type2.gameObject.SetActive(false); } else { type2.gameObject.SetActive(true); type2.sprite = typeToImage(PokemonDatabase.getPokemonbyID(id).getType2()); } }
// Usability Functions private void setText(int id) { if (id != 1f) { tertiary.transform.parent.gameObject.SetActive(true); string name0 = PokemonDatabase.getPokemonbyID(id - 1).getName() + " " + toNum(id - 1); tertiary.text = name0; tertiaryShadow.text = name0; } else { tertiary.transform.parent.gameObject.SetActive(false); } string name = PokemonDatabase.getPokemonbyID(id).getName() + " " + toNum(id); primary.text = name; primaryShadow.text = name; if (id != PokemonDatabase.getPokedexLength() - 1) { secondary.transform.parent.gameObject.SetActive(true); string name0 = PokemonDatabase.getPokemonbyID(id + 1).getName() + " " + toNum(id + 1); secondary.text = name0; secondaryShadow.text = name0; } else { secondary.transform.parent.gameObject.SetActive(false); } // Set Image string path = AssetDatabase.GetAssetPath(spritesheet); Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(path).OfType <Sprite>().ToArray(); preview.sprite = sprites [PokemonDatabase.getPokemonbyID(id).getID() - 1]; preview.gameObject.GetComponent <RectTransform> ().sizeDelta = sprites [PokemonDatabase.getPokemonbyID(id).getID() - 1].bounds.size * 37; setTyping(id); }