/// <summary> Sets name and gender of pokemon in UI. </summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetName(PokemonInstanceStatus status) { string genderStr = ""; if (status.state.gender != PokeGender.None) { genderStr = " <sprite=" + '"' + status.state.gender.ToString() + '"' + " index=0>"; } name.text = status.Name + genderStr; }
/// <summary> Applys a state to an instanced pokemon. </summary> /// <param name="status"> Scriptable object state to apply to this instanced pokemon. </param> public void ApplyState(PokemonInstanceStatus status) { /* Establish Reference To Scriptable Object State */ state = status.state; /* Update Stats Using Level */ GetStats(); /* Generate Move Instances As Children To Pokemon */ GenerateMoves(); /* Generate Status Effect Instances As Children To Pokemon */ GenerateStatusEffects(); }
/// <summary> Instantly re-writes the party member UI to match all the information about the pokemon. </summary> /// <param name="status"> Status to extract information from. </param> public void LoadState(PokemonInstanceStatus status) { if (statusEffects == null) { statusEffects = new List <StatusEffectUI>(); } /* Set all UI Elements For This Pokemon */ portrait_face.gameObject.SetActive(true); SetName(status); SetFace(status); SetLevel(status); SetHP(status); SetXP(status); SetStatusEffects(status); isLoaded = true; }
/// <summary> /// Queue's one of the trainer's available move for summon. /// The move can be executed by starting the 'Summon' coroutine. /// The move is queued in order for the battle system to react to /// a pending summon, if any behaviors wish to use the information about /// this pokemon's pending move. /// </summary> /// <param name="slot"> /// The slot number of the move to be executed. /// This will return an error if the slot is out of range or no move exsists in that slot. /// </param> public void QueuePartyMember(int slot) { /* Throw Error At User and Return If Slot Is Out of Range */ if (slot < 1 || slot > 6) { Debug.LogError(slot + " is NOT a valid slot for accessing party memebers. Use slots 1 -> 6"); return; } /* Warn User and Return If NO Move Exsists In Slot */ if (party[slot - 1] == null) { Debug.LogWarning(slot + " does NOT have a party member assigned to it."); return; } /* Otherwise, Set the Current Move and Current Target */ QueuedPokemon = party[slot - 1]; }
/// <summary> Re-writes the entire status effect display. </summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetStatusEffects(PokemonInstanceStatus status) { /* Remove and Destroy Current Fields */ for (int i = statusEffects.Count - 1; i >= 0; i--) { Destroy(statusEffects[i].gameObject); statusEffects.RemoveAt(i); } /* Foreach New Status Effect */ foreach (StatusEffect effect in status.state.statusEffects) { /* Instantiate A New Field */ StatusEffectUI field = Instantiate(statusEffectPrefab, statusEffectsContainer); /* Fill In The Field */ field.Load(effect); /* Add This Field To List Of Fields */ statusEffects.Add(field); } }
/// <summary> Sets XP gauge based on pokemon. </summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetXP(PokemonInstanceStatus status) { /* Scale and Color the HP Bar */ xpGauge_bar.rectTransform.localScale = new Vector3(status.state.xP, xpGauge_bar.rectTransform.localScale.y, 1); }
/// <summary> Sets HP count and gauge in UI based on pokemon. </summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetHP(PokemonInstanceStatus status) { hpGauge_bar.rectTransform.localScale = new Vector3(status.state.hP, hpGauge_bar.rectTransform.localScale.y, 1); hpGauge_bar.color = hpColorPicker.Evaluate(status.state.hP); }
/// <summary> Sets level of pokemon in UI.</summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetLevel(PokemonInstanceStatus status) { level.text = "Lvl " + status.state.level; }
/// <summary> Sets portrait face of pokemon in UI. </summary> /// <param name="status"> Pokemon status to extract information from. </param> private void SetFace(PokemonInstanceStatus status) { portrait_face.sprite = status.pokemon.Face; }