Example #1
0
        private void DrawEntry_StatData(int index)
        {
            StatTracker.StatData curStat = _target.sceneStats[index];

            curStat.id = (TrackedStatType)EditorGUILayout.EnumPopup("ID", curStat.id);

            curStat.startValue = EditorGUILayout.FloatField("Start Value", curStat.startValue);
            //	Only change if not playing. Otherwise if watching values the current
            //	value constantly gets overwritten by the default value.
            if (!EditorApplication.isPlaying)
            {
                curStat.currentValue = curStat.startValue;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Current: " + curStat.currentValue, GUILayout.Width(100));
            EditorGUILayout.LabelField("Persistent: " + curStat.persistentValue, GUILayout.Width(100));
            EditorGUILayout.EndHorizontal();
        }
Example #2
0
        private void RebuildUsedStats()
        {
            List <StatTracker.StatData> newStats = new List <StatTracker.StatData> ();

            List <TrackedStatType> curEnumVals = new List <TrackedStatType>
                                                     ((TrackedStatType[])System.Enum.GetValues(typeof(TrackedStatType)));

            for (int i = 0; i < curEnumVals.Count; i++)
            {
                if (GetStatDataOfType(newStats, curEnumVals[i]) != null)
                {
                    continue;
                }

                StatTracker.StatData existingStat = GetStatDataOfType(_target.sceneStats, curEnumVals[i]);
                newStats.Add(existingStat != null ? existingStat : new StatTracker.StatData(curEnumVals[i], 0));
            }

            _target.sceneStats.Clear();
            _target.sceneStats = newStats;
        }