예제 #1
0
    public void Init()
    {
        GenericCharacter genericCharacter = new GenericCharacter();

        genericCharacter.SetIsPlayerControlled(true);
        genericCharacter.SetCharacterName("Abbarath");
        genericCharacter.SetCharacterMana(50);
        genericCharacter.SetSpriteFileName("wizard_1_attack-a_001.png");
        genericCharacter.SetSpriteFilePath("Test_Assets");
        genericCharacter.AddActionIDToUsableActionList(ActionData.ACTION_LIST_ID.HEAL_TARGET);
        genericCharacter.AddActionIDToUsableActionList(ActionData.ACTION_LIST_ID.MULTI_STRIKE);

        SetCharacterStats(genericCharacter);

        GameManager.GetPlayerManager.AddCharacterToList(genericCharacter);
    }
예제 #2
0
    public void Init()
    {
        GenericCharacter genericCharacter = new GenericCharacter();

        genericCharacter.SetIsPlayerControlled(false);
        genericCharacter.SetCharacterName("Enemy_Wolf");
        genericCharacter.SetCharacterMana(40);
        genericCharacter.SetCharacterHealth(500);
        genericCharacter.SetSpriteFileName("wolf.png");
        genericCharacter.SetSpriteFilePath("Test_Assets");
        genericCharacter.AddActionIDToUsableActionList(ActionData.ACTION_LIST_ID.MULTI_STRIKE);
        genericCharacter.AddActionIDToUsableActionList(ActionData.ACTION_LIST_ID.STRIKE);

        SetCharacterStats(genericCharacter);

        //We do not do this with enemies. Add it in combat manager
        //GameManager.GetPlayerManager.AddCharacterToList(genericCharacter);
    }
예제 #3
0
    public void InitCharacterWithJSON(string aJSONFilePath)
    {
        TextAsset file          = Resources.Load(aJSONFilePath) as TextAsset;
        JSONNode  characterJSON = JSON.Parse(file.ToString());

        Debug.Log(characterJSON);

        if (m_CharacterStats == null)
        {
            m_CharacterStats = new GenericCharacter();
        }

        m_CharacterStats.SetIsPlayerControlled(characterJSON["isPlayerControlled"]);
        m_CharacterStats.SetIsCharacterDead(characterJSON["isCharacterDead"]);
        m_CharacterStats.SetCharacterHasMana(characterJSON["doesCharacterHaveMana"]);
        m_CharacterStats.SetCharacterName(characterJSON["characterName"]);
        m_CharacterStats.SetSpriteFilePath(characterJSON["spriteFilePath"]);
        m_CharacterStats.SetSpriteFileName(characterJSON["spriteName"]);
        m_CharacterStats.SetCharacterHealth(characterJSON["characterStats"]["maxHealth"]);
        m_CharacterStats.SetCurrentHealth(characterJSON["characterStats"]["currentHealth"]);
        m_CharacterStats.SetShield(characterJSON["characterStats"]["shield"]);
        m_CharacterStats.SetStrength(characterJSON["characterStats"]["strength"]);
        m_CharacterStats.SetSpellPower(characterJSON["characterStats"]["spellPower"]);

        if (characterJSON["actionListIDs"].IsArray)
        {
            for (int i = 0; i < characterJSON["actionListIDs"].AsArray.Count; i++)
            {
                //TODO: Check if ability is in the dictionary first before trying to add to character
                //NOTE: I might already be doing that in another function that gets called when I add it.
                //What in the C# wizardy f**k is this
                ActionData.ACTION_LIST_ID action = (ActionData.ACTION_LIST_ID)System.Enum.Parse(typeof(ActionData.ACTION_LIST_ID), characterJSON["actionListIDs"][i]);

                m_CharacterStats.AddActionIDToUsableActionList(action);
            }
        }

        //Oh god here we go again with the magic
        m_CharacterStats.AddEquipmentToCharacter(
            (ItemData.ITEM_ID)System.Enum.Parse(typeof(ItemData.ITEM_ID), characterJSON["equipmentSlots"]["chest"])
            );
        m_CharacterStats.AddEquipmentToCharacter(
            (ItemData.ITEM_ID)System.Enum.Parse(typeof(ItemData.ITEM_ID), characterJSON["equipmentSlots"]["helm"])
            );
        m_CharacterStats.AddEquipmentToCharacter(
            (ItemData.ITEM_ID)System.Enum.Parse(typeof(ItemData.ITEM_ID), characterJSON["equipmentSlots"]["weapon"])
            );
        m_CharacterStats.AddEquipmentToCharacter(
            (ItemData.ITEM_ID)System.Enum.Parse(typeof(ItemData.ITEM_ID), characterJSON["equipmentSlots"]["ring"])
            );

        //Unload this somewhere....? at some point in time? Not sure where, but somewhere...

        string spritePath = m_CharacterStats.GetSpriteFilePath() + "/" + m_CharacterStats.GetSpriteFileName();

        m_SpriteRenderer.sprite = Resources.Load <Sprite>(spritePath);

        Resources.UnloadAsset(file);

        GameManager.GetPlayerManager.AddCharacterToList(m_CharacterStats);
    }