/// <summary> /// Draws the editor for the Character class components & references. /// </summary> private void DrawComponentsAndReferences() { // If playing, display editor for the health bar & the throwable if (EditorApplication.isPlaying) { TDS_EditorUtility.ObjectField("Health Bar", "HitBox of this character, used to detect what they touch when attacking", healthBar, typeof(UnityEngine.UI.Image)); GUILayout.Space(3); if (!targets.Any(t => t is TDS_Juggler) && TDS_EditorUtility.ObjectField("Throwable", "Throwable this character is actually wearing", throwable, typeof(TDS_Throwable))) { { characters.ForEach(c => c.GrabObject((TDS_Throwable)throwable.objectReferenceValue)); serializedObject.Update(); } } GUILayout.Space(5); } TDS_EditorUtility.ObjectField("Hit Box", "HitBox of this character, used to detect what they touch when attacking", hitBox, typeof(TDS_HitBox)); TDS_EditorUtility.ObjectField("Hands Transform", "Transform at the position of the character hands ; mainly used as root for carrying throwable", handsTransform, typeof(Transform)); TDS_EditorUtility.ObjectField("Shadow Transform", "Transform of the character's shadow", shadowTransform, typeof(Transform)); GUILayout.Space(3); }
/// <summary> /// Draws the custom editor for the components & references of this class. /// </summary> private void DrawComponentsAndReferences() { if (EditorApplication.isPlaying) { TDS_EditorUtility.PropertyField("Throwables in Hands", "All throwables currently juggling with", throwables); GUILayout.Space(5); if (TDS_EditorUtility.ObjectField("Selected Throwable", "Currently selected throwable to use", throwable, typeof(TDS_Throwable))) { jugglers.ForEach(j => j.Throwable = (TDS_Throwable)throwable.objectReferenceValue); serializedObject.Update(); } GUILayout.Space(5); } GUILayout.Space(5); TDS_EditorUtility.ObjectField("Juggle Transform", "Juggle transform, where to set as children objects juggling with", juggleTransform, typeof(Transform)); GUILayout.Space(3); TDS_EditorUtility.PropertyField("Object Anchors", "Object anchors when juggling", objectAnchors); }
/// <summary> /// Draws the editor for Damageable class components & references /// </summary> private void DrawComponentsAndReferences() { TDS_EditorUtility.ObjectField("Animator", "Animator of this object", animator, typeof(Animator)); TDS_EditorUtility.ObjectField("Collider", "Non-trigger BoxCollider of this object, used to detect collisions", collider, typeof(BoxCollider)); TDS_EditorUtility.ObjectField("Rigidbody", "Rigidbody of this character, used for physic simulation", rigidbody, typeof(Rigidbody)); TDS_EditorUtility.ObjectField("Sprite", "Main SpriteRenderer used to render this object", sprite, typeof(SpriteRenderer)); GUILayout.Space(3); }
/// <summary> /// Draws the components & references editor of the TDS_Player editing objects. /// </summary> private void DrawComponentsAndReferences() { TDS_EditorUtility.PropertyField("Ground detection Box", "Virtual box used to detect if the player is on ground or not", groundDetectionBox); GUILayout.Space(5); TDS_EditorUtility.ObjectField("Interaction Box", "Trigger used to detect the available interactions of the player", interactionBox, typeof(TDS_PlayerInteractionBox)); TDS_EditorUtility.ObjectField("FX Transform", "Transform used to spawn all kind of FXs", fxTransformPV, typeof(PhotonView)); TDS_EditorUtility.ObjectField("Summoner object", "The Summoner the player is actually wearing", summoner, typeof(TDS_Summoner)); }
protected override void DrawSettings() { base.DrawSettings(); TDS_EditorUtility.IntSlider("Damages Threshold", "How much damages had to be taken to play the hit animation", damagesThreshold, 1, 50); TDS_EditorUtility.ObjectField("Boss Portrait", "Portrait to display next to the boss' lifebar", portrait, typeof(GameObject)); EditorGUILayout.LabelField("Health events", TDS_EditorUtility.HeaderStyle); TDS_EditorUtility.PropertyField("On Two Thirds Health", "Event called when the boss has reached two thirds of his life", onTwoThirdsHealth); TDS_EditorUtility.PropertyField("On Half Health", "Event called when the boss has reached half of his life", onHalfHealth); TDS_EditorUtility.PropertyField("On One Third Health", "Event called when the boss has reached one third of his life", onOneThirdHealth); }
/// <summary> /// Draw the split settings /// </summary> private void DrawSplittingSettings() { if (IsEnemyUnfolded) { EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Box"); //Draw a header for the enemy spinning settings if (TDS_EditorUtility.Button("Splitting Enemies", "Wrap / unwrap splitting enemies", TDS_EditorUtility.HeaderStyle)) { AreSplittingSettingsUnfolded = !areSplittingSettingsUnfolded; } if (areSplittingSettingsUnfolded) { EditorGUILayout.Space(); for (int i = 0; i < splitingEnemiesNames.arraySize; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(splitingEnemiesNames.GetArrayElementAtIndex(i).stringValue, TDS_EditorUtility.HeaderStyle); GUITools.ActionButton("X", RemoveSettingsAtIndex, i, Color.white, Color.black, "Remove this spliting enemy"); Repaint(); serializedObject.ApplyModifiedProperties(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); TDS_Enemy _e = null; _e = EditorGUILayout.ObjectField("Add Splitting Enemy", _e, typeof(TDS_Enemy), false) as TDS_Enemy; if (_e != null) { splitingEnemiesNames.InsertArrayElementAtIndex(0); splitingEnemiesNames.GetArrayElementAtIndex(0).stringValue = _e.EnemyName; splitingPosition.InsertArrayElementAtIndex(0); splitingPosition.GetArrayElementAtIndex(0).vector3Value = Vector3.forward; Repaint(); } EditorGUILayout.Space(); TDS_EditorUtility.ObjectField("Splitting Portrait", "Portrait of the splitting enemies", splittingPortrait, typeof(GameObject)); serializedObject.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } }
/// <summary> /// Draws the custom editor of the editing TDS_Camera objects. /// </summary> public void DrawEditor() { // Records any changements on the editing objects to allow undo Undo.RecordObjects(targets, "Camera script(s) settings"); // Updates the SerializedProperties to get the latest values serializedObject.Update(); TDS_EditorUtility.ObjectField("Camera", "Camera component attached to this script", camera, typeof(Camera)); GUILayout.Space(1); if (TDS_EditorUtility.ObjectField("Target", "Target this camera has to follow", cTarget, typeof(Transform))) { cameras.ForEach(c => c.Target = (Transform)cTarget.objectReferenceValue); } GUILayout.Space(3); TDS_EditorUtility.ObjectField("Top Bound", "Top bound collider of this level", topBound, typeof(BoxCollider)); TDS_EditorUtility.ObjectField("Left Bound", "Left bound collider of this level", leftBound, typeof(BoxCollider)); TDS_EditorUtility.ObjectField("Right Bound", "Right bound collider of this level", rightBound, typeof(BoxCollider)); TDS_EditorUtility.ObjectField("Bottom Bound", "Bottom bound collider of this level", bottomBound, typeof(BoxCollider)); GUILayout.Space(3); TDS_EditorUtility.PropertyField("Current Bounds", "Current bounds of the camera", currentBounds); GUILayout.Space(3); TDS_EditorUtility.PropertyField("Level Bounds", "Global bounds of the camera in the Level", levelBounds); TDS_EditorUtility.Vector3Field("Offset", "Offset of the camera from its target", offset); GUILayout.Space(1); if (TDS_EditorUtility.FloatSlider("Rotation", "Rotation in X axis of the camera", rotation, 0, 90)) { cameras.ForEach(c => c.Rotation = rotation.floatValue); } GUILayout.Space(2); if (EditorApplication.isPlaying && !serializedObject.isEditingMultipleObjects) { TDS_EditorUtility.ProgressBar(20, speedCurrent.floatValue / speedMax.floatValue, "Speed"); } if (TDS_EditorUtility.FloatSlider("Initial Speed", "Initial speed of the camera when starting moving", speedInitial, 0, speedMax.floatValue)) { cameras.ForEach(c => c.SpeedInitial = speedInitial.floatValue); } if (TDS_EditorUtility.FloatField("Max Speed", "Maximum value of this camera speed", speedMax)) { cameras.ForEach(c => c.SpeedMax = speedMax.floatValue); } if (TDS_EditorUtility.FloatField("Speed Coef", "Coefficient used to multiply the speed of the camera", speedCoef)) { cameras.ForEach(c => c.SpeedCoef = speedCoef.floatValue); } if (TDS_EditorUtility.FloatField("Speed Accl. Time", "Time the speed of the camera take from its initial value to reach its maximum value", speedAccelerationTime)) { cameras.ForEach(c => c.SpeedAccelerationTime = speedAccelerationTime.floatValue); } TDS_EditorUtility.FloatField("Viewport Y Max Bound Value", "This would be too complicated to describe here...", ViewportYMaxBoundValue); GUILayout.Space(5); TDS_EditorUtility.RadioToggle("Moving", "Is the camera currently moving", isMoving); // Apply modifications serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Draws the custom editor for the components & references of this class. /// </summary> private void DrawComponentsAndReferences() { TDS_EditorUtility.ObjectField("Mini Game Anchor", "Anchor used for the mini game sprites", miniGameAnchor, typeof(Transform)); TDS_EditorUtility.ObjectField("Mini Game Sprite", "Sprite of the mini game wheel", miniGameSprite, typeof(SpriteRenderer)); }
/// <summary> /// Draw the Editor of the enemy's components and references /// Display an object field for the anemy's agent /// </summary> private void DrawComponentsAndReferences() { TDS_EditorUtility.ObjectField("Agent", "Custom NavMesh Agent of the enemy. \n Used to navigate", agent, typeof(CustomNavMeshAgent)); GUILayout.Space(3); }
/// <summary> /// Draws the custom editor for the components & references of this class. /// </summary> private void DrawComponentsAndReferences() { TDS_EditorUtility.ObjectField("Beard FX Transform PV", "PhotonView of the Transform used for beard related FXs", beardFXTransformPV, typeof(PhotonView)); }