Exemple #1
0
        // Finds the stat of the given name and compares it to is_
        // If the stat is not found, false is given as the stat value
        // Equals checks if the strings are the same, or if they are different
        public static bool Compare_String_Stat_To(string stat_name, string is_, bool equals)
        {
            // Check if the stat exists
            if (!StatsManager.String_Stat_Exists(stat_name))
            {
                Debug.Log("Comparing string stat. " + stat_name + " does not exist");
            }

            return(equals == (StatsManager.Get_String_Stat(stat_name).Equals(is_)));
        }
Exemple #2
0
        void Update()
        {
            // Don't do anything if no Stat name is defined
            if (string.IsNullOrEmpty(name_of_stat_to_retrieve))
            {
                return;
            }


            string stat = "";

            // Retrieve the correct stat
            switch (type_of_stat_to_retrieve)
            {
            case Type_of_Stat.Numbered_Stat:
                // Check if we should display nothing if the stat does not exist
                if (display_nothing_if_stat_not_present && !StatsManager.Numbered_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = "" + StatsManager.Get_Numbered_Stat(name_of_stat_to_retrieve);
                break;

            case Type_of_Stat.String_Stat:
                if (display_nothing_if_stat_not_present && !StatsManager.String_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = StatsManager.Get_String_Stat(name_of_stat_to_retrieve);
                break;

            case Type_of_Stat.Boolean_Stat:
                if (display_nothing_if_stat_not_present && !StatsManager.Boolean_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = "" + StatsManager.Get_Boolean_Stat(name_of_stat_to_retrieve);
                break;
            }

            // Construct the actual string
            text_element.text = message_before_stat + stat + message_after_stat;
        }