private void Update() { SimpleFollowerAnim.Follow(SPData, Followers); }
void UpdateSpline() { SimpleFollowerAnim.Follow(SPData, Followers); }
public void Branch_Deleted(int branchKey) { SimpleFollowerAnim.Follow(SPData, Followers); }
private void OnGUI() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.ObjectField(follower.FindPropertyRelative("FollowerGO"), typeof(GameObject), new GUIContent("Follower")); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); var Distance = EditorGUILayout.FloatField("Distance", follower.FindPropertyRelative("Distance").floatValue); if (EditorGUI.EndChangeCheck()) { var branchDist = sPData.Length; if (Distance < 0) { Distance = 0; } else if (Distance > branchDist) { Distance = branchDist; } follower.FindPropertyRelative("Distance").floatValue = Distance; follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUILayout.BeginHorizontal(); var position = EditorGUILayout.Vector3Field("Position", follower.FindPropertyRelative("Position").vector3Value); if (follower.FindPropertyRelative("Position").vector3Value != position) { follower.FindPropertyRelative("Position").vector3Value = position; follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(follower.FindPropertyRelative("SpaceType"), new GUIContent(""), GUILayout.Width(60)); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); var rotation = EditorGUILayout.Vector3Field("Rotation", follower.FindPropertyRelative("Rotation").vector3Value); if (follower.FindPropertyRelative("Rotation").vector3Value != rotation) { follower.FindPropertyRelative("Rotation").vector3Value = rotation; follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(follower.FindPropertyRelative("LockRotation"), new GUIContent(""), GUILayout.Width(60)); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); var elements = new string[] { "Animation" }; _follower.ToolBareSelection = GUILayout.Toolbar(_follower.ToolBareSelection, elements); switch (_follower.ToolBareSelection) { case 0: Animation(); break; } }
void Animation() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(follower.FindPropertyRelative("Animation"), new GUIContent(""), GUILayout.Width(40)); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } EditorGUI.BeginChangeCheck(); var speed = EditorGUILayout.FloatField("Speed", follower.FindPropertyRelative("Speed").floatValue); if (EditorGUI.EndChangeCheck()) { if (speed < 0) { speed = 0; } follower.FindPropertyRelative("Speed").floatValue = speed; follower.serializedObject.ApplyModifiedProperties(); } EditorGUI.BeginChangeCheck(); var Accel_Time = EditorGUILayout.FloatField("Full Speed Time", follower.FindPropertyRelative("TimeToReachFullSpeed").floatValue); if (EditorGUI.EndChangeCheck()) { if (Accel_Time < 0) { Accel_Time = 0; } follower.FindPropertyRelative("TimeToReachFullSpeed").floatValue = Accel_Time; follower.serializedObject.ApplyModifiedProperties(); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField( follower.FindPropertyRelative("_FollowerAnimation"), new GUIContent("Animation insectType")); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); } GUI.enabled = (follower.FindPropertyRelative("_FollowerAnimation").enumValueIndex == (int)FollowerAnimation.Keyboard) ? true : false; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(follower.FindPropertyRelative("FlipDirection"), new GUIContent("Flip Direction")); if (EditorGUI.EndChangeCheck()) { follower.serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(sPData, _follower); } GUI.enabled = true; EditorGUILayout.EndVertical(); }
public void Init() { SerializedProperty FollowersSP = serializedObject.FindProperty("Followers"); FollowersList = new ReorderableList(SimpleFollowersClass.Followers, typeof(Follower), true, false, true, true); FollowersList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { SerializedProperty follower = FollowersSP.GetArrayElementAtIndex(index); EditorGUI.BeginChangeCheck(); EditorGUI.PropertyField(new Rect(rect.x, rect.y, 40, rect.height), follower.FindPropertyRelative("Animation"), new GUIContent("")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(SimpleFollowersClass.SPData, SimpleFollowersClass.Followers); } EditorGUI.BeginChangeCheck(); EditorGUI.ObjectField(new Rect(rect.x + 50, rect.y, rect.width - 130, rect.height), follower.FindPropertyRelative("FollowerGO"), typeof(GameObject), new GUIContent("")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); SimpleFollowerAnim.Follow(SimpleFollowersClass.SPData, SimpleFollowersClass.Followers); } if (GUI.Button(new Rect(rect.x + rect.width - 70, rect.y, 70, rect.height), "Settings")) { FollowerWindow wind = (FollowerWindow)EditorWindow.GetWindow(typeof(FollowerWindow), true, "Simple Follower Settings", true); wind.Show(SimpleFollowersClass.SPData, follower, SimpleFollowersClass.Followers[index]); } }; FollowersList.onAddCallback = (ReorderableList list) => { var t = FollowersSP.arraySize; FollowersSP.InsertArrayElementAtIndex(t); FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("FollowerGO").objectReferenceValue = null; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("Animation").enumValueIndex = (int)Switch.On; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("FlipDirection").boolValue = false; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("IsForward").boolValue = true; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("Distance").floatValue = 0; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("Speed").floatValue = 2.5f; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("TimeToReachFullSpeed").floatValue = 0; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("_FollowerAnimation").enumValueIndex = (int)FollowerAnimation.Auto; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("LockRotation").enumValueIndex = (int)Switch.Off; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("Position").vector3Value = Vector3.zero; FollowersSP.GetArrayElementAtIndex(t).FindPropertyRelative("Rotation").vector3Value = Vector3.zero; serializedObject.ApplyModifiedProperties(); }; FollowersList.onRemoveCallback = (ReorderableList list) => { var cachedIndex = FollowersList.index; FollowersSP.DeleteArrayElementAtIndex(cachedIndex); FollowersList.index = cachedIndex - 1; serializedObject.ApplyModifiedProperties(); }; }
void Branch_Deleted(int branchKey) { SimpleFollowerAnim.Follow(SimpleFollowersClass.SPData, SimpleFollowersClass.Followers); }
void Update_Spline() { SimpleFollowerAnim.Follow(SimpleFollowersClass.SPData, SimpleFollowersClass.Followers); }