Exemplo n.º 1
0
 private void DeleteAbility(NWAbility ability)
 {
     if (_selectedCard != null)
     {
         if (_selectedCard.Abilities != null && _selectedCard.Abilities.Contains(ability))
         {
             _selectedCard.Abilities[_selectedCard.Abilities.IndexOf(ability)] = null;
         }
     }
 }
Exemplo n.º 2
0
        private void AbilityEdit(NWAbility ability)
        {
            if (ability != null)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginVertical("Box");

                EditorGUILayout.BeginHorizontal();

                ability.Type = (NWAbilityType)EditorGUILayout.EnumPopup("Ability Type:", ability.Type);

                if (GUILayout.Button("Add Effect"))
                {
                    if (ability.Effects == null)
                    {
                        ability.Effects = new List<NWEffect>();
                    }
                    NWEffect effect = new NWEffect();
                    effect.Target = new NWTarget();
                    effect.Count = new NWCount();
                    ability.Effects.Add(effect);
                }

                if (GUILayout.Button("Delete Ability"))
                {
                    Debug.Log("before: " + ability);
                    DeleteAbility(ability);
                    Debug.Log("after: " + ability);
                    return;
                }

                EditorGUILayout.EndHorizontal();

                // triggers

                EditorGUILayout.BeginVertical("Box");

                switch (ability.Type)
                {
                case NWAbilityType.Activated:
                {
                    break;
                }
                case NWAbilityType.Triggered:
                {
                    if (ability.Trigger == null)
                    {
                        EditorGUILayout.BeginHorizontal();

                        _tmpTriggerSelction = (NWTriggerType)EditorGUILayout.EnumPopup("Trigger Type:", _tmpTriggerSelction);
                        if (GUILayout.Button("Create Trigger"))
                        {
                            ability.Trigger = new NWTrigger();
                            ability.Trigger.Target = new NWTarget();
                            ability.Trigger.Type = _tmpTriggerSelction;
                            _tmpTriggerSelction = NWTriggerType.None;
                        }
                        EditorGUILayout.EndHorizontal();
                    }

                    else
                    {
                        EditorGUILayout.BeginHorizontal();
                        ability.Trigger.Type = (NWTriggerType)EditorGUILayout.EnumPopup("Trigger Type:", ability.Trigger.Type);
                        if (GUILayout.Button("Delete Trigger"))
                        {
                            ability.Trigger = null;
                            return;
                        }
                        EditorGUILayout.EndHorizontal();

                        switch (ability.Trigger.Type)
                        {
                        case NWTriggerType.EnterZone:
                        {
                            EditorGUILayout.BeginHorizontal();

                            ability.Trigger.ToZone = (eZoneType)EditorGUILayout.EnumPopup("Zone To Enter: ", ability.Trigger.ToZone);

                            EditTarget(ability.Trigger.Target);

                            EditorGUILayout.EndHorizontal();
                            break;
                        }
                        default:
                        {
                            break;
                        }
                        }
                    }
                    break;
                }
                case NWAbilityType.Static:
                {
                    break;
                }
                case NWAbilityType.None:
                default:
                {
                    break;
                }
                }

                EditorGUILayout.EndVertical();

                // Effects

                if (ability.Effects != null)
                {
                    foreach (NWEffect effect in ability.Effects)
                    {
                        if (effect != null)
                        {
                            EditorGUILayout.BeginVertical("Box");

                            EditorGUILayout.BeginHorizontal();
                            effect.Type = (NWEffectType)EditorGUILayout.EnumPopup("Effect Type: ", effect.Type);
                            effect.InfoText = EditorGUILayout.TextField("Info Text: ", effect.InfoText);
                            if (GUILayout.Button("Delete Effect"))
                            {
                                ability.Effects[ability.Effects.IndexOf(effect)] = null;
                                return;
                            }
                            EditorGUILayout.EndHorizontal();

                            switch (effect.Type)
                            {
                            case NWEffectType.DrawCards:
                            {
                                EditTarget(effect.Target);
                                EditCount(effect.Count);
                                break;
                            }
                            default:
                            {
                                break;
                            }
                            }

                            EditorGUILayout.EndVertical();
                        }
                        else
                        {
                            ability.Effects.Remove(effect);
                            return;
                        }

                    }
                }

                EditorGUILayout.EndVertical();

            }
        }
Exemplo n.º 3
0
 private void OnAbilityActivatedHandler(NWAbility ability)
 {
     if (OnAbilityActivated != null)
     {
         OnAbilityActivated(this, ability);
     }
 }