Пример #1
0
        void DebugApplyAdjustment()
        {
            // Never runtime debug the root parent. This will cause catastrophic data corruption
            if (!IsRuntimeViewable)
            {
                return;
            }

            EditorGUILayout.LabelField("Debug - Stats Adjustment", EditorStyles.boldLabel);

            _adjustment = (StatsAdjustment)EditorGUILayout.ObjectField("Adjustment", _adjustment, typeof(StatsAdjustment), false);
            if (_adjustment == null)
            {
                return;
            }

            _adjustmentIndex = EditorGUILayout.FloatField(new GUIContent("Adjustment Index", "Index of the applied adjustment"),
                                                          _adjustmentIndex);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Apply"))
            {
                _adjustment.ApplyAdjustment(Target, _adjustmentIndex);
            }

            if (GUILayout.Button("Remove"))
            {
                _adjustment.RemoveAdjustment(Target);
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #2
0
        public void SetupStatsAdjustment()
        {
            _adjustment = ScriptableObject.CreateInstance <StatsAdjustment>();
            _statCol    = ScriptableObject.CreateInstance <StatDefinitionCollection>();

            _health = ScriptableObject.CreateInstance <StatDefinition>();
            SetPrivateField(_health, "_id", "health");
            _health.Value.type = StatValueType.Int;
            _health.Value.GetValue().SetInt(10);
            _statCol.definitions.Add(_health);

            _attack = ScriptableObject.CreateInstance <StatDefinition>();
            SetPrivateField(_attack, "_id", "attack");
            _attack.Value.type = StatValueType.Float;
            _attack.Value.GetValue().SetFloat(3);
            _statCol.definitions.Add(_attack);

            _data            = ScriptableObject.CreateInstance <StatsContainer>();
            _data.collection = _statCol;
        }