示例#1
0
    static void PartsStartingStats(string line)
    {
        string[]   elements = line.Split(',');
        GameObject obj      = GetOrCreate(elements[0]);
        Job        job      = obj.GetComponent <Job>();

        for (int i = 1; i < Job.statOrder.Length + 1; i++)
        {
            if (elements[i] != null)
            {
                job.baseStats[i - 1] = Convert.ToInt32(elements[i]);
            }
        }
        StatModifierFeature move = GetFeature(obj, StatTypes.Mov);

        move.amount = Convert.ToInt32(elements[7]);

        StatModifierFeature mdf = GetFeature(obj, StatTypes.eq_Mdf);

        mdf.amount = 50;

        StatModifierFeature ac = GetFeature(obj, StatTypes.eq_AC);

        ac.amount = 50;

        StatModifierFeature jumpU = GetFeature(obj, StatTypes.JtU);

        jumpU.amount = 5;

        StatModifierFeature jumpD = GetFeature(obj, StatTypes.JtD);

        jumpD.amount = 5;
    }
示例#2
0
        private static void PartsStartingStats(string line)
        {
            string[] elements = line.Split(',');
            if (elements[0] == "")
            {
                Debug.LogError("Invalid line: " + line);
                return;
            }

            GameObject obj = GetOrCreate(elements[0]);
            Job        job = obj.GetComponent <Job>();

            for (int i = 1; i < Job.statOrder.Length + 1; ++i)
            {
                job.baseStats[i - 1] = Convert.ToInt32(elements[i]);
            }

            StatModifierFeature evade = GetFeature(obj, StatTypes.EVD);

            evade.amount = Convert.ToInt32(elements[8]);

            StatModifierFeature res = GetFeature(obj, StatTypes.RES);

            res.amount = Convert.ToInt32(elements[9]);

            StatModifierFeature move = GetFeature(obj, StatTypes.MOV);

            move.amount = Convert.ToInt32(elements[10]);

            StatModifierFeature jump = GetFeature(obj, StatTypes.JMP);

            jump.amount = Convert.ToInt32(elements[11]);
        }
示例#3
0
    static void ParseStartingStats(string line)
    {
        string[]   elements = line.Split(',');
        GameObject obj      = GetOrCreate(elements[0]);
        Job        job      = obj.GetComponent <Job>();

        for (int i = 1; i < Job.statOrder.Length + 1; i++)
        {
            job.baseStats[i - 1] = Convert.ToInt32(elements[i]);
        }

        StatModifierFeature evade = GetFeature(obj, StatTypes.EVD);

        evade.amount = Convert.ToInt32(elements[8]);

        StatModifierFeature res = GetFeature(obj, StatTypes.RES);

        res.amount = Convert.ToInt32(elements[9]);

        StatModifierFeature mov = GetFeature(obj, StatTypes.MOV);

        mov.amount = Convert.ToInt32(elements[10]);

        StatModifierFeature jump = GetFeature(obj, StatTypes.JMP);

        jump.amount = Convert.ToInt32(elements[11]);
    }
示例#4
0
 void OnEnable()
 {
     statusEffectIcon = Resources.Load <Sprite>("Sprites/StatusIcons/StopStatusIcon");
     feature          = gameObject.AddComponent <StatModifierFeature>();
     feature.type     = StatTypes.DEX;
     feature.amount   = -1000;
     feature.Activate(GetComponentInParent <Unit>().gameObject);
 }
示例#5
0
    GameObject CreateItem(string title, StatTypes type, int amount)
    {
        GameObject          item = new GameObject(title);
        StatModifierFeature smf  = item.AddComponent <StatModifierFeature>();

        smf.type   = type;
        smf.amount = amount;
        return(item);
    }
示例#6
0
    Equippable CreateEquipment(string name, StatTypes stat, int amount, EquipSlots slot)
    {
        GameObject instance = new GameObject(name);
        Equippable item     = instance.AddComponent <Equippable>();

        item.defaultSlots = slot;
        StatModifierFeature feature = instance.AddComponent <StatModifierFeature>();

        feature.amount = amount;
        feature.type   = stat;
        return(item);
    }
    static StatModifierFeature GetFeature(GameObject obj, StatTypes type)
    {
        StatModifierFeature[] smf = obj.GetComponents <StatModifierFeature>();
        for (int i = 0; i < smf.Length; ++i)
        {
            if (smf[i].type == type)
            {
                return(smf[i]);
            }
        }
        StatModifierFeature feature = obj.AddComponent <StatModifierFeature>();

        feature.type = type;
        return(feature);
    }
示例#8
0
    void ConsumeItem(GameObject item)
    {
        inventory.Remove(item);
        // This is dummy code - a user would know how to use an item and who to target with it
        StatModifierFeature smf = item.GetComponent <StatModifierFeature>();

        if (smf.amount > 0)
        {
            item.GetComponent <Consumable>().Consume(combatants[0]);
            Debug.Log("Ah... a potion!");
        }
        else
        {
            item.GetComponent <Consumable>().Consume(combatants[1]);
            Debug.Log("Take this you stupid monster!");
        }
    }
示例#9
0
    static void PartsStartingStats(string line)
    {
        //string manipulation (read how csv is handled in text format later)
        string[]   elements = line.Split(',');
        GameObject obj      = GetOrCreate(elements[0]);
        Job        job      = obj.GetComponent <Job>();

        for (int i = 1; i < Job.statOrder.Length + 1; ++i)
        {
            job.baseStats[i - 1] = Convert.ToInt32(elements[i]); //actually getting the stats
        }
        //jump and move stats will go to the modifier since they'll be relevant on the map logic
        StatModifierFeature move = GetFeature(obj, StatTypes.MOV);

        move.amount = Convert.ToInt32(elements[8]);
        StatModifierFeature jump = GetFeature(obj, StatTypes.JMP);

        jump.amount = Convert.ToInt32(elements[9]);
    }