Exemple #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            SerializedProperty angle      = property.FindPropertyRelative("_angle");
            SerializedProperty timescaled = property.FindPropertyRelative("_timescaled");
            double             scale      = LSEditorUtility.Scale(timescaled.boolValue);

            angle.doubleValue    = EditorGUILayout.DoubleField(label, angle.doubleValue * scale) / scale;
            timescaled.boolValue = EditorGUILayout.Toggle("Timescaled", timescaled.boolValue);

            double angleInRadians = angle.doubleValue * Math.PI / 180d;

            property.FindPropertyRelative("_cos").longValue = FixedMath.Create(Math.Cos(angleInRadians));
            property.FindPropertyRelative("_sin").longValue = FixedMath.Create(Math.Sin(angleInRadians));
        }