Ejemplo n.º 1
0
    // Always get the STElementInfo from the front of the list
    private STElement CreateElement(Vector3 position)
    {
        if (infos.Count <= 0)
        {
            return(null);
        }
        STElementInfo info = infos[0];

        infos.RemoveAt(0);
        GameObject element = Instantiate(st_element,
                                         position,
                                         Quaternion.identity) as GameObject;
        STElement st = element.GetComponent <STElement>();

        st.ConfigureElement(info);
        return(st);
    }
Ejemplo n.º 2
0
    public void ConfigureElement(STElementInfo info)
    {
        m_info = info;

        Sprite[] textures = Resources.LoadAll<Sprite>("images/st_elements");
        string sprite = info.sprite;
        if(sprite == "battle") {
            sprite = "battle" + info.eventInfo.mobs.Count;
        }
        foreach(Sprite s in textures) {
            if(s.name == sprite) {
                m_realTexture = s;
                break;
            }
        }
        m_sprite.color = info.color;
    }
Ejemplo n.º 3
0
    public void ConfigureElement(STElementInfo info)
    {
        m_info = info;

        Sprite[] textures = Resources.LoadAll <Sprite>("images/st_elements");
        string   sprite   = info.sprite;

        if (sprite == "battle")
        {
            sprite = "battle" + info.eventInfo.mobs.Count;
        }
        foreach (Sprite s in textures)
        {
            if (s.name == sprite)
            {
                m_realTexture = s;
                break;
            }
        }
        m_sprite.color = info.color;
    }
Ejemplo n.º 4
0
    public int LoadStoryTrackJSON(string trackName)
    {
        infos.Clear();
        ClearElements();
        TextAsset json = (TextAsset)Resources.Load(levelFilename, typeof(TextAsset));

        if (!json)
        {
            Debug.LogError("Couldn't find: " + levelFilename);
            return(0);
        }
        string   content     = json.text;
        JSONNode track       = JSON.Parse(content);
        int      tileCount   = track["eventCount"].AsInt;
        int      loadedTiles = 0;

        for (int j = 0; j < tileCount; j++, loadedTiles++)
        {
            JSONNode      stEvent = track["events"][j];
            STElementInfo element = new STElementInfo(stEvent);
            infos.Add(element);
        }
        return(loadedTiles);
    }
Ejemplo n.º 5
0
    private void CreateTwist(string sprite)
    {
        STElementInfo info = new STElementInfo(sprite);

        infos.Insert(0, info);
    }
Ejemplo n.º 6
0
 private void CreateTwist(string sprite)
 {
     STElementInfo info = new STElementInfo(sprite);
     infos.Insert (0, info);
 }
Ejemplo n.º 7
0
 public int LoadStoryTrackJSON(string trackName)
 {
     infos.Clear();
     ClearElements();
     TextAsset json = (TextAsset)Resources.Load(levelFilename, typeof(TextAsset));
     if(!json) {
         Debug.LogError("Couldn't find: " + levelFilename);
         return 0;
     }
     string content = json.text;
     JSONNode track = JSON.Parse(content);
     int tileCount = track["eventCount"].AsInt;
     int loadedTiles = 0;
     for(int j = 0; j < tileCount; j++, loadedTiles++) {
         JSONNode stEvent = track["events"][j];
         STElementInfo element = new STElementInfo(stEvent);
         infos.Add(element);
     }
     return loadedTiles;
 }