List <bool> InitFoldout(EnemyTypeData data) { List <bool> foldout = new List <bool>(); int nbAttacks = data.AttackList.Count; for (int i = 0; i < nbAttacks; i++) { foldout.Add(false); } return(foldout); }
EnemyTypeData DisplayForm(EnemyTypeData data, ref List <bool> foldout) { EnemyTypeData newData = new EnemyTypeData(); newData.Speed = EditorGUILayout.FloatField("Speed", data.Speed); newData.DashDistance = EditorGUILayout.FloatField("Dash Distance", data.DashDistance); newData.VitaeDropQuantity = EditorGUILayout.IntField("Vitae Drop Quantity", data.VitaeDropQuantity); newData.Agressivity = EditorGUILayout.IntSlider("Agressivity", data.Agressivity, 0, 100); bool addButton = GUILayout.Button("Add new attack"); newData.AttackList = DisplayAttackForm(data, ref foldout); if (addButton) { newData.AttackList.Add(new AttackStats()); foldout.Add(false); } return(newData); }
public override void Start() { //StartCoroutine(EnemyAttack()); base.Start(); if (m_DataList) { m_Data = m_DataList.GetDataFromType(m_Type); } m_AttackBox = GetComponentInChildren <AttackBox>(true); m_CurrentSpeed = m_Data.Speed; m_EnemyManager.RegisterEnemy(this); if (attack1 == null) { attack1 = Instantiate(m_FXAttack1); } visualFeedback = GetComponent <VisualFeedback>(); }
List <AttackStats> DisplayAttackForm(EnemyTypeData data, ref List <bool> foldout) { List <AttackStats> newList = new List <AttackStats>(); int nbAttacks = data.AttackList.Count; for (int i = 0; i < nbAttacks; i++) { AttackStats stats = data.AttackList[i]; string label; if (!string.IsNullOrEmpty(stats.name)) { label = stats.name; } else { label = "New Attack"; } foldout[i] = EditorGUILayout.Foldout(foldout[i], label); if (foldout[i]) { stats.name = EditorGUILayout.TextField("Attack Name", stats.name); stats.damage = EditorGUILayout.IntField("Damage", stats.damage); stats.stunDuration = EditorGUILayout.IntField("Stun Duration", stats.stunDuration); GUILayout.Space(5f); } newList.Add(stats); } return(newList); }