Example #1
0
    public void SetCharacter(string entityIdentitifer)
    {
        m_entityData = GameDataManager.instance.GetEntityData(entityIdentitifer);
        Sprite sprite = SpriteDatabaseManager.instance.GetSprite(m_entityData.m_icon);

        charButton.GetComponent <Image>().sprite = sprite;
    }
Example #2
0
    private void DrawLoadSave()
    {
        //Draw Globals
        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Save Entity Data"))
        {
            string savePath;
            if (Utils.SaveFileDialog(CharacterEditorWindow.m_activeEntityData.DataFileExtension(), "Save Entity Data", out savePath))
            {
                Utils.Save(CharacterEditorWindow.m_activeEntityData, savePath);
            }
        }
        if (GUILayout.Button("Load Entity Data"))
        {
            string path;
            if (Utils.OpenFileDialog(CharacterEditorWindow.m_activeEntityData.DataFileExtension(), "Load Entity Data", out path))
            {
                MobaEntityData newEntityData = CharacterEditorWindow.m_activeEntityData.LoadEntityData(path);

                if (CharacterEditorWindow.m_gameDataManager.ReplaceEntityData(CharacterEditorWindow.m_activeEntityData, newEntityData))
                {
                    CharacterEditorWindow.m_activeEntityData = newEntityData;
                    EditorUtility.SetDirty(CharacterEditorWindow.m_gameDataManager);
                    AssetDatabase.SaveAssets();
                    Debug.Log("Entity Data Replaced");
                }
                else
                {
                    Debug.LogError("Error: Cant replace entity data");
                }
            }
        }
        EditorGUILayout.EndHorizontal();
    }
Example #3
0
    /// <summary>
    /// Virtual Method  that Initializes a MobaEntity and load all configuration from the MobaEntity data
    /// This Method can be override by custom entities to load custom entity data
    /// </summary>
    /// <param name="data">MobaEntity Data</param>
    /// <param name="instanceId">Unique Instance Identifier for this Entity</param>
    public virtual void InitializeEntity(MobaEntityData data, string instanceId)
    {
        m_entityData     = data;
        m_dataIdentifier = data.m_dataIdentifier;
        //GENERAL VARIABLES
        m_instanceId = instanceId;
        m_goldBonus  = data.m_goldBonus;

        //OFFENSIVE VARIABLES
        EntityAbilities.BaseAttackDamage = data.m_baseAttackDamage;
        EntityAbilities.BaseMagicDamage  = data.m_baseMagicDamage;

        //DEFENSIVE VARIABLES
        EntityAbilities.Armor    = data.m_armor;
        EntityAbilities.MagicRes = data.m_magicRes;

        //HEALTH VARIABLES
        m_healthMax        = data.m_healthMax;
        m_health           = m_healthMax;
        m_healthRegenerate = data.m_healthRegenerate;

        //MANA VARIABLES
        m_manaMax          = data.m_manaMax;
        m_mana             = m_manaMax;
        m_manaRegeneration = data.m_manaRegeneration;

        m_dead   = false;
        m_target = null;
    }
Example #4
0
 //Initialize the current entity, and load the entityData from its identifier
 public override void InitializeEntity(MobaEntityData entityData, string identifier)
 {
     base.InitializeEntity(entityData, identifier);
     //Initialize additional parameters
     ServerSetEntityTeam(entityData.m_team);
     m_entityData = entityData;
     InitializePathRenderer();
 }
Example #5
0
    private bool LoadEntityClientAssets()
    {
        MobaEntityData entityentityData = CharacterEditorWindow.m_activeEntityData;

        CharacterEditorWindow.m_serverEntityPrefab = CharacterEditorWindow.m_entityHolderPrefab.GetPrefabFromHolder(entityentityData.m_prefab);
        CharacterEditorWindow.m_clientEntityPrefab = CharacterEditorWindow.m_entityHolderPrefab.GetPrefabFromHolder(entityentityData.m_prefab + "Client");

        m_prefabsLoaded = CharacterEditorWindow.m_serverEntityPrefab != null && CharacterEditorWindow.m_clientEntityPrefab != null;

        return(m_prefabsLoaded);
    }
Example #6
0
    private void DrawCharacterBox(MobaEntityData entityData)
    {
        GUILayout.BeginVertical(m_boxStyle);
        HighlightGUI(entityData.m_dataIdentifier == m_selectionID);
        if (GUILayout.Button(entityData.m_dataIdentifier, CharacterEditorWindow.m_skin.button))
        {
            (m_parent as CharacterEditorWindow).LoadCharacterView(entityData);

            m_selectionID = entityData.m_dataIdentifier;
        }
        HighlightGUI(false);
        GUILayout.EndVertical();
    }
Example #7
0
    private void SaveCharacter()
    {
        MobaEntityData entityData = CharacterEditorWindow.m_activeEntityData;

        if (CharacterEditorWindow.m_entityHolderPrefab.RemovePrefab(entityData.m_prefab) && CharacterEditorWindow.m_entityHolderPrefab.RemovePrefab(entityData.m_prefab + "Client"))
        {
            GameObject newClientPrefab = PrefabUtility.ReplacePrefab(m_characterInstance, CharacterEditorWindow.m_clientEntityPrefab, ReplacePrefabOptions.Default);
            GameObject newServerPrefab = PrefabUtility.ReplacePrefab(m_characterInstance, CharacterEditorWindow.m_serverEntityPrefab, ReplacePrefabOptions.Default);
            CharacterEditorWindow.m_entityHolderPrefab.AddPrefab(newServerPrefab, true);
            CharacterEditorWindow.m_entityHolderPrefab.AddPrefab(newClientPrefab);
            EditorUtility.SetDirty(CharacterEditorWindow.m_entityHolderPrefab);
            AssetDatabase.SaveAssets();
        }
    }
Example #8
0
 public void CharacterChanged(string characterIdentifier)
 {
     if (!string.IsNullOrEmpty(characterIdentifier))
     {
         MobaEntityData entityData = GameDataManager.instance.GetEntityData(characterIdentifier);
         Sprite         sprite     = SpriteDatabaseManager.instance.GetSprite(entityData.m_icon);
         slotButton.GetComponent <Image>().sprite = sprite;
         CharNameBox.text = entityData.m_dataDisplayName;
         m_character      = characterIdentifier;
     }
     else
     {
         CharNameBox.text = "EmptySlot";
         Sprite sprite = SpriteDatabaseManager.instance.GetSprite("EmptySlot_Sprite");
         slotButton.GetComponent <Image>().sprite = sprite;
         m_character = "";
     }
 }
Example #9
0
 /// <summary>
 /// Add a new Entity Data to the Data Manager
 /// </summary>
 /// <param name="entityData">Entity Data to add</param>
 public void AddEntityData(MobaEntityData entityData)
 {
     if (entityData is CharacterData)
     {
         m_characterData.Add(entityData as CharacterData);
     }
     else if (entityData is MinionData)
     {
         m_minionData.Add(entityData as MinionData);
     }
     else if (entityData is NexusData)
     {
         m_nexusData.Add(entityData as NexusData);
     }
     else if (entityData is TowerData)
     {
         m_towerData.Add(entityData as TowerData);
     }
 }
Example #10
0
    /// <summary>
    /// Replaces a current Entity Data
    /// </summary>
    /// <param name="entityData">Entity Data To Remove</param>
    /// <param name="newEntityData">Entity Data To Add</param>
    /// <returns></returns>
    public bool ReplaceEntityData(MobaEntityData entityData, MobaEntityData newEntityData)
    {
        for (var i = 0; i < m_nexusData.Count; i++)
        {
            if (m_nexusData[i].m_dataIdentifier == entityData.m_dataIdentifier)
            {
                m_nexusData[i] = newEntityData as NexusData;
                return(true);
            }
        }

        for (var i = 0; i < m_towerData.Count; i++)
        {
            if (m_towerData[i].m_dataIdentifier == entityData.m_dataIdentifier)
            {
                m_towerData[i] = newEntityData as TowerData;
                return(true);
            }
        }

        for (var i = 0; i < m_minionData.Count; i++)
        {
            if (m_minionData[i].m_dataIdentifier == entityData.m_dataIdentifier)
            {
                m_minionData[i] = newEntityData as MinionData;
                return(true);
            }
        }

        for (var i = 0; i < m_characterData.Count; i++)
        {
            if (m_characterData[i].m_dataIdentifier == entityData.m_dataIdentifier)
            {
                m_characterData[i] = newEntityData as CharacterData;
                return(true);
            }
        }

        Debug.LogError("Cant find the Data Identifier to remove: ");
        return(false);
    }
 public void LoadCharacterView(MobaEntityData entityData)
 {
     m_activeEntityData = entityData;
     m_characterCreation.Initialize();
     CharacterEditorWindow.m_currentState = CharacterEditorWindow.ECharacterEditorState.CreatingCharacter;
 }
Example #12
0
 //Initialize the current entity, and load the entityData from its identifier
 public override void InitializeEntity(MobaEntityData entityData, string identifier)
 {
     base.InitializeEntity(entityData, identifier);
     //Initialize additional parameters
 }