Ejemplo n.º 1
0
    private Dictionary <string, skillCell> loadScript(string fileName)
    {
        JSONObject loadedScript = null;
        // Key값으로 스킬들을 구분하고 있어 외부 라이브러리와 섞어 사용함.
        Dictionary <string, skillCell> loadSkillset = null;

        try {
            TextAsset jsonText = Resources.Load(string.Format("json/skill/{0}", fileName)) as TextAsset;
            loadedScript = new JSONObject(jsonText.text);
            loadSkillset = new Dictionary <string, skillCell>();

            foreach (string key in loadedScript.keys)
            {
                string    jsonStr = loadedScript.GetField(key).ToString();
                skillCell skill   = JsonUtility.FromJson <skillCell>(jsonStr);
                loadSkillset.Add(key, skill);
            }
        }
        catch (System.Exception error) {
            Debug.LogError(string.Format("Load Fail : json/skill/{0}", fileName));
            Debug.LogError(error);
        }

        return(loadSkillset);
    }
Ejemplo n.º 2
0
 private void skillCellActive(skillCell skill)
 {
     loopCount    = skill.loop;
     currentSkill = skill;
     Debug.Log(loopCount);
     if (loopCount == 0)
     {
         skillLoop();
     }
     else
     {
         InvokeRepeating("skillLoop", this.infomation.beforeDelay, skill.loopTime);
     }
 }