Exemplo n.º 1
0
    private void updateParty()
    {
        for (int i = 0; i < 6; i++)
        {
            OwnedPokemon selectedPokemon = SaveData.currentSave.PC.boxes[0][i];
            if (selectedPokemon == null)
            {
                slot[i].gameObject.SetActive(false);
            }
            else
            {
                slot[i].gameObject.SetActive(true);
                selectBall[i].texture     = selectBallClosed;
                icon[i].texture           = selectedPokemon.GetIcons();
                pokemonName[i].text       = selectedPokemon.GetName();
                pokemonNameShadow[i].text = pokemonName[i].text;
                if (selectedPokemon.Gender == PokemonGender.FEMALE)
                {
                    gender[i].text  = "♀";
                    gender[i].color = new Color(1, 0.2f, 0.2f, 1);
                }
                else if (selectedPokemon.Gender == PokemonGender.MALE)
                {
                    gender[i].text  = "♂";
                    gender[i].color = new Color(0.2f, 0.4f, 1, 1);
                }
                else
                {
                    gender[i].text = null;
                }
                genderShadow[i].text = gender[i].text;
                HPBar[i].pixelInset  = new Rect(HPBar[i].pixelInset.x, HPBar[i].pixelInset.y,
                                                Mathf.FloorToInt(48f * ((float)selectedPokemon.GetCurrentStatValue(PokemonStatType.HP) / (float)selectedPokemon.GetCurrentLevelStatValue(PokemonStatType.HP))),
                                                HPBar[i].pixelInset.height);

                if ((float)selectedPokemon.GetCurrentStatValue(PokemonStatType.HP) < ((float)selectedPokemon.GetCurrentLevelStatValue(PokemonStatType.HP) / 4f))
                {
                    HPBar[i].color = new Color(1, 0.125f, 0, 1);
                }
                else if ((float)selectedPokemon.GetCurrentStatValue(PokemonStatType.HP) < ((float)selectedPokemon.GetCurrentLevelStatValue(PokemonStatType.HP) / 2f))
                {
                    HPBar[i].color = new Color(1, 0.75f, 0, 1);
                }
                else
                {
                    HPBar[i].color = new Color(0.125f, 1, 0.065f, 1);
                }

                level[i].text           = "" + selectedPokemon.CurrentLevel;
                levelShadow[i].text     = level[i].text;
                currentHP[i].text       = "" + selectedPokemon.GetCurrentStatValue(PokemonStatType.HP);
                currentHPShadow[i].text = currentHP[i].text;
                maxHp[i].text           = "" + selectedPokemon.GetCurrentLevelStatValue(PokemonStatType.HP);
                maxHPShadow[i].text     = maxHp[i].text;
                if (selectedPokemon.CurrentStatus != PokemonStatus.NONE)
                {
                    status[i].texture =
                        Resources.Load <Texture>("PCSprites/status" + selectedPokemon.CurrentStatus.ToString());
                }
                else
                {
                    status[i].texture = null;
                }
                if (!string.IsNullOrEmpty(selectedPokemon.getHeldItem()))
                {
                    item[i].enabled = true;
                }
                else
                {
                    item[i].enabled = false;
                }
            }
        }
    }