Ejemplo n.º 1
0
    /// <summary>
    /// Validate if all necessary configurations for the creation of npc exists.
    /// </summary>
    /// <returns></returns>
    private bool ValidateSetup()
    {
        if (_allClass.Count <= 0)
        {
            GUILayout.BeginArea(npcSection);
            EditorGUILayout.HelpBox("No data class found", MessageType.Error);
            if (GUILayout.Button("Create new class"))
            {
                CharacterClass.CreateCharacterClass();
                Selection.activeObject = AssetDatabase.LoadAssetAtPath("Assets/Resources/CharacterData/Data/Character Class/CharacterClass.asset", typeof(CharacterClass));
                this.Close();
            }
            GUILayout.EndArea();
            return(false);
        }

        if (_npcWeaponType == null)
        {
            GUILayout.BeginArea(npcSection);
            EditorGUILayout.HelpBox("No setup for weapons", MessageType.Error);
            if (GUILayout.Button("Create Setup"))
            {
                WeaponType.CreateWeaponType();
                _npcWeaponType = (WeaponType)AssetDatabase.LoadAssetAtPath("Assets/Resources/CharacterData/Data/NPCSetup/WeaponType.asset", typeof(WeaponType));
            }
            GUILayout.EndArea();
            return(false);
        }
        else if (_npcDamageType == null)
        {
            GUILayout.BeginArea(npcSection);
            EditorGUILayout.HelpBox("No setup for Damage type", MessageType.Error);
            if (GUILayout.Button("Create Setup"))
            {
                DamageType.CreateWeaponType();
                _npcDamageType = (DamageType)AssetDatabase.LoadAssetAtPath("Assets/Resources/CharacterData/Data/NPCSetup/DamageType.asset", typeof(DamageType));
            }
            GUILayout.EndArea();
            return(false);
        }
        else if (_npcStrategyType == null)
        {
            GUILayout.BeginArea(npcSection);
            EditorGUILayout.HelpBox("No setup for Strategy type", MessageType.Error);
            if (GUILayout.Button("Create Setup"))
            {
                StrategyType.CreateWeaponType();
                _npcStrategyType = (StrategyType)AssetDatabase.LoadAssetAtPath("Assets/Resources/CharacterData/Data/NPCSetup/StrategyType.asset", typeof(StrategyType));
            }
            GUILayout.EndArea();
            return(false);
        }

        return(true);
    }