Exemplo n.º 1
0
    public void Move()
    {
        for (int i = 0; i < char_ui_elems.Count; i++)
        {
            CharInfoHolder char_info_holder = char_ui_elems[i].GetComponent <CharInfoHolder>();

            if (char_info_holder == null)
            {
                throw new System.Exception(char_ui_elems[i].name + " UI element does not have CharInfoHolder component defined");
            }

            SODict curr_char_info = GetSingleElem.Get(curr_char) as SODict;

            if (curr_char_info == char_info_holder.char_info)
            {
                // Enable / Show the Image
                image.enabled = true;

                // This RectTransform
                RectTransform curr_rect_transform = GetComponent <RectTransform>();

                // Move to chosen char RectTransform
                curr_rect_transform.position = char_info_holder.gameObject.GetComponent <RectTransform>().position;
            }
        }
    }
Exemplo n.º 2
0
    public static SODict Get(int level, SOList difficulty_list)
    {
        for (int i = 0, l = difficulty_list.v.Count; i < l; i++)
        {
            SODict level_difficulty_elem = difficulty_list.v[i] as SODict;

            int from_lvl = (level_difficulty_elem.v["from_lvl"] as IntVariable).v;
            int to_lvl   = (level_difficulty_elem.v["to_lvl"] as IntVariable).v;

            // Debug.Log("from_lvl: " + from_lvl + " to_lvl: " + to_lvl);

            if (from_lvl <= level && level <= to_lvl)
            {
                // Debug.Log("return");
                return(level_difficulty_elem);
            }

            // If none is appropriate, the level is higher than the to_lvl of the last elem
            // So just return the last configured setting
            if (i == l - 1)
            {
                return(level_difficulty_elem);
            }
        }

        return(null);
    }
Exemplo n.º 3
0
    public GameObject GetCharModelByRef(SODict char_info)
    {
        if (planes_refs.ContainsKey(char_info))
        {
            return(planes_refs[char_info]);
        }

        throw new System.Exception(char_info.name + " char info does not exist in planes_refs dctonary!");
    }
Exemplo n.º 4
0
    public void Change(SODict new_char_info)
    {
        if (owned_characters.v.Contains(new_char_info))
        {
            string single_key = GetSingleElem.GetKey(curr_char);
            curr_char.ChangeValue(single_key, new_char_info);

            curr_char_updated.Raise();
        }
    }
Exemplo n.º 5
0
    public void UpdateMesh()
    {
        SODict curr_char_info = GetSingleElem.Get(curr_char) as SODict;

        GameObject char_model = planes_ref_holder.GetCharModelByRef(curr_char_info);

        MeshRenderer char_model_mesh_renderer = char_model.GetComponentInChildren <MeshRenderer>();
        MeshFilter   char_model_mesh_filter   = char_model.GetComponentInChildren <MeshFilter>();

        planes_ref_holder.CopyCharModel(transform.gameObject, char_model_mesh_renderer, char_model_mesh_filter);
    }
Exemplo n.º 6
0
    public static ScriptableObject Get(SODict sodict)
    {
        // sodict should always have only one key
        if (sodict.v.Count != 1)
        {
            throw new System.Exception("The curr_char SODict count does not equal 1!");
        }

        // Get a single elem from that single key
        SODict single_elem = null;

        foreach (KeyValuePair <string, ScriptableObject> entry in sodict.v)
        {
            single_elem = sodict.v[entry.Key] as SODict;
        }

        return(single_elem);
    }
Exemplo n.º 7
0
    public void CreateLevel()
    {
        // Local level variable to predict how much platforms_count will be in the future
        int predicted_level = levels_passed.v;

        // Update the real level progress data
        SODict level_difficulty_elem = GetElemByLevel.Get(levels_passed.v, difficulty_list);

        int level_platforms_count = (level_difficulty_elem.v["platforms_count"] as IntVariable).v;

        // Create tiles
        for (int i = 0; i < level_platforms_count + extra_platforms; i++)
        {
            dist_z += height_step;
            CreateNextTile();
        }

        currlevel_platforms_count.v = (level_difficulty_elem.v["platforms_count"] as IntVariable).v;

        currlevel_platforms_passed.v = 0;
    }
Exemplo n.º 8
0
    public void SetCoinsByList(IntVariable levels_passed)
    {
        SODict elem = GetElemByLevel.Get(levels_passed.v - 1, difficulty_list);

        coins = (elem.v["coins"] as IntVariable).v;
    }