public override void OnInspectorGUI() { CharacterConfiguration characterConfiguration = target as CharacterConfiguration; if (characterConfiguration == null) { return; } SerializedObject serialized_characterConfiguration = new SerializedObject(characterConfiguration); SerializedProperty baseNameProperty = serialized_characterConfiguration.FindProperty("BaseName"); SerializedProperty moveSpeedProperty = serialized_characterConfiguration.FindProperty("MoveSpeed"); SerializedProperty idleTimeRangeProperty = serialized_characterConfiguration.FindProperty("IdleTime"); SerializedProperty usernameOffsetProperty = serialized_characterConfiguration.FindProperty("UsernameOffset"); SerializedProperty usernameSizeProperty = serialized_characterConfiguration.FindProperty("UsernameSize"); SerializedProperty usernameColorProperty = serialized_characterConfiguration.FindProperty("UsernameColor"); DrawSectionHeader("Appearance"); EditorGUILayout.PropertyField(baseNameProperty); EditorGUILayout.Space(10f); EditorGUILayout.PropertyField(usernameOffsetProperty); EditorGUILayout.PropertyField(usernameSizeProperty); EditorGUILayout.PropertyField(usernameColorProperty); EditorGUILayout.Space(10f); DrawSectionHeader("Mechanics"); EditorGUILayout.PropertyField(moveSpeedProperty); EditorGUILayout.Space(10f); characterConfiguration.RandomIdleTime = EditorGUILayout.Toggle("Random Idle Time", characterConfiguration.RandomIdleTime); if (characterConfiguration.RandomIdleTime) { EditorGUILayout.PropertyField(idleTimeRangeProperty); } else { characterConfiguration.IdleTime.x = EditorGUILayout.FloatField("Idle Time", characterConfiguration.IdleTime.x); characterConfiguration.IdleTime.y = characterConfiguration.IdleTime.x; } serialized_characterConfiguration.ApplyModifiedProperties(); EditorUtility.SetDirty(characterConfiguration); }
private static void UpdateCharacterMechanicsValues(Character character) { Chat chat = GetChat(); CharacterConfiguration characterConfiguration = chat.CharacterConfiguration; character.PCharacter.name = characterConfiguration.BaseName; if (character.PCharacter.name.Contains(Constants.TEXT_KEY_USERNAME)) { character.PCharacter.name = character.PCharacter.name.Replace(Constants.TEXT_KEY_USERNAME, character.FollowerReference.UserName); } character.MoveSpeed = characterConfiguration.MoveSpeed; }