Beispiel #1
0
        public override void Run_Node()
        {
            switch (stat_type)
            {
            case Stat_Type.Set_Number:
                StatsManager.Set_Numbered_Stat(stat_name, set_number_to);
                break;

            case Stat_Type.Modify_Number:
                StatsManager.Add_To_Numbered_Stat(stat_name, modify_number_amount);
                break;

            case Stat_Type.Set_Boolean:
                StatsManager.Set_Boolean_Stat(stat_name, set_bool_to);
                break;

            case Stat_Type.Toggle_Boolean:
                StatsManager.Toggle_Boolean_Stat(stat_name);
                break;

            case Stat_Type.Set_String:
                StatsManager.Set_String_Stat(stat_name, set_string_to);
                break;
            }

            if (print_all_stats_to_console)
            {
                StatsManager.Print_All_Stats();
            }

            Finish_Node();
        }
        public void InputfieldInputToStats(string stat_name)
        {
            switch (stat_type)
            {
            case Stat.Boolean_Stat:
                Debug.LogError("Boolean stats are not supported in InputfieldToStat", this.gameObject);
                break;

            case Stat.Numbered_Stat:
                StatsManager.Set_Numbered_Stat(stat_name, float.Parse(this.GetComponent <InputField>().text));
                break;

            case Stat.String_Stat:
                StatsManager.Set_String_Stat(stat_name, this.GetComponent <InputField>().text);
                break;
            }
        }
        public override void Run_Node()
        {
            if (string.IsNullOrEmpty(Stat_To_Save_To))
            {
                Debug.LogError("Stat_To_Save_To is empty. Please specify the name of a Stat to save to for this GenerateRandomNumberNode", this.gameObject);
                Finish_Node();
                return;
            }

            float value_from_stat = 0;
            float randomly_generated_num;

            if (use_whole_numbers)
            {
                randomly_generated_num = (float)Random.Range((int)minimum_random_number, (int)maximum_random_number + 1);
            }
            else
            {
                randomly_generated_num = Random.Range(minimum_random_number, maximum_random_number);
            }

            if (!string.IsNullOrEmpty(Stat_To_Add_To_Random_Number))
            {
                value_from_stat = StatsManager.Get_Numbered_Stat(Stat_To_Add_To_Random_Number);
            }

            float result = randomly_generated_num + value_from_stat;

            StatsManager.Set_Numbered_Stat(Stat_To_Save_To, result);

            if (print_result_to_console)
            {
                Debug.Log("Rolled " + randomly_generated_num + ", added to value from Stat " + value_from_stat + " gives total: " + result + " saved in " + Stat_To_Save_To, this.gameObject);
            }

            Finish_Node();
        }