//----------------------------------------------------------------------------------------------------------- //------------------------------------- ATTACKS ---------------------------------------- //----------------------------------------------------------------------------------------------------------- void InitAttacks(PokemonDatabase.PokemonItem pokemonDb) { List <PokemonDatabase.PokemonAttack> pokeAttacks = pokemonDb.m_attacksByLvl; // Get Moveset && attacks info int i = 0; while (i < pokeAttacks.Count && pokeAttacks[i].m_level <= m_level) { i++; } for (int j = 0; j < 4; j++) { if (i > 0) { // Fill attack id m_moveSet[j] = pokeAttacks[j].m_attackId; // Get attack's info AttackDatabase.AttackItem attack = AttackDatabase.GetAttackById(pokeAttacks[j].m_attackId); m_ppMax[j] = attack.m_pp; m_ppCurrent[j] = attack.m_pp; i--; } else { m_moveSet [j] = -1; } } }
//---------------------------------------------------------------------------- protected override void DrawElement(Rect rect, int index, bool selected, bool focused) { AttackDatabase.AttackItem item = AttackDatabase.GetAttackById(index); if (item != null) { if (!string.IsNullOrEmpty(item.m_name)) { GUI.Label(rect, item.m_index.ToString() + ": " + item.m_name); } else { GUI.Label(rect, "Un-named!"); } if (selected) { if (m_currentlySelected != index) { m_currentlySelected = index; this.Repaint(); } } } }
//---------------------------------------------------------------------------- protected override void OnInternalInspectorGUI() { AttackDatabase.AttackItem item = AttackDatabase.GetAttackById(m_currentlySelected); if (item != null) { GUILayout.BeginHorizontal(); { GUILayout.BeginVertical(); { EditorGUILayout.LabelField("Attack Index", item.m_index.ToString()); item.m_name = EditorGUILayout.TextField("Attack Name", item.m_name); item.m_description = EditorGUILayout.TextField("Attack description", item.m_description); GUILayout.BeginHorizontal(); { item.m_attackType = (EAttackType)EditorGUILayout.EnumPopup("Nature of attack", item.m_attackType); item.m_type = (EPokemonType)EditorGUILayout.EnumPopup("Type of attack", item.m_type); } GUILayout.EndHorizontal(); item.m_puissance = EditorGUILayout.IntField("Puissance", item.m_puissance); item.m_precision = EditorGUILayout.IntField("Precision", item.m_precision); item.m_priorite = EditorGUILayout.IntField("Priorite", item.m_priorite); item.m_pp = EditorGUILayout.IntField("PP", item.m_pp); } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); } if (GUI.changed) { EditorUtility.SetDirty(target); } }
public void Reset() { attack = new AttackDatabase.AttackItem(-1); damageDealt = 0; }