Beispiel #1
0
        public float LevelScalar()
        {
            if (updateLevelScalar)
            {
                updateLevelScalar = false;

                PropertyDriver driver = (sharedDriver != null) ? sharedDriver : this;

                float s;

                if (driver.onBeat)
                {
                    float beatScale = (level.beatScalar == 1.0f) ? 1.0f : 0.0f;

                    s = Mathf.Clamp(level.fallingLevel * driver.strength * beatScale, 0.0f, driver.clipping);
                }
                else
                {
                    s = Mathf.Clamp(level.fallingLevel * driver.strength, 0.0f, driver.clipping);
                }

                scaledLevel.y = driver.travel.magnitude * s;
            }

            return(scaledLevel.y);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            PropertyDriver driver = (PropertyDriver)target;

            EditorGUILayout.PropertyField(levelProp, new GUIContent("Level", "The Level this driver uses to calculate the travel distance. If this is set to None, then it'll try to find a Level at runtime by looking up through the hierarchy."));
            EditorGUILayout.PropertyField(sharedMotionProp, new GUIContent("Shared Driver", "Travel, Max Level, Strength, and On Beat are all overidden by the ones in this shared driver."));

            GUI.enabled = (driver.sharedDriver == null);

            TravelGUI();

            EditorGUILayout.PropertyField(strengthProp, new GUIContent("Strength", "Scales the level's magnitude. This is useful to get values to reach their max travel distance sooner."));
            EditorGUILayout.PropertyField(maxLevelProp, new GUIContent("Clipping", "Clips the level's magnitude. A value of 1 will allow the level to reach 100% of its magnitude."));
            EditorGUILayout.PropertyField(onBeatProp, new GUIContent("On Beat", "Only compute a travel distance when a beat is detected, otherwise the travel is set to 0. Beats occur for one frame only."));

            ExtendedGUI();

            ErrorGUI();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }