private void RenderGeneratorStuff() { SpiritTeam t = target as SpiritTeam; var sprop = serializedObject.FindProperty("Spirits"); libraryList = library.Spirits.Select(s => s.Name).ToArray(); // list of available spirits EditorGUILayout.BeginHorizontal(); selectedListItem = EditorGUILayout.Popup(selectedListItem, libraryList); selectedLevel = Mathf.Clamp(EditorGUILayout.IntField(selectedLevel), 1, 100); GUI.enabled = t.Spirits.Count < 6; if (GUILayout.Button("Generate")) { var generated = Spirit.GenerateSpirit(library.Spirits[selectedListItem], selectedLevel, atkLibrary); int newIndex = sprop.arraySize; sprop.InsertArrayElementAtIndex(newIndex); var newspirit = sprop.GetArrayElementAtIndex(newIndex); // newspirit.FindPropertyRelative("Name").stringValue = "test"; fillPropertyFromObject(newspirit, generated); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public BattleObject(SpiritTeam enemyTeam, SpiritTeam playerTeam = null, GameObject trainer = null) { this.enemyTeam = enemyTeam; if (playerTeam == null) { playerTeam = new SpiritTeam(); playerTeam.Spirits = new List <Spirit>(); for (int i = 0; i < Mathf.Min(6, Player.Instance.team.Count); ++i) { playerTeam.Spirits[i] = (Player.Instance.team[i]); } } else { this.playerTeam = playerTeam; } this.trainer = trainer; trainerFight = trainer != null; }
// --- /* [SerializeField] private bool recovering; * [SerializeField] private float recovertime;*/ public void Start() { team = team?.Clone() as SpiritTeam; // bo = new BattleObject(team); }