//Returns the pointer to the objective public ObjectivePtr FindObjectivePtr(BioObjective objective) { for (int i = 0; i < ObjectivePtrs.Length; i++) { if (ObjectivePtrs[i].Objective == objective) { return(ObjectivePtrs[i]); } } return(null); }
public BioObjective AddObjective(ObjectiveType type) { BioObjective objective = Utility.AddObjective(this, type); if (objective == null) { Debug.Log("The objective could not be found."); return(null); } else { System.Array.Resize(ref Objectives, Objectives.Length + 1); Objectives[Objectives.Length - 1] = objective; Character.Refresh(); return(Objectives[Objectives.Length - 1]); } }
private void DrawObjective(BioObjective objective, bool selected) { if (!selected) { return; } switch (objective.GetObjectiveType()) { case ObjectiveType.Position: DrawPosition((Position)objective); break; case ObjectiveType.Orientation: DrawOrientation((Orientation)objective); break; case ObjectiveType.LookAt: DrawLookAt((LookAt)objective); break; case ObjectiveType.Distance: DrawDistance((Distance)objective); break; case ObjectiveType.JointValue: DrawJointValue((JointValue)objective); break; case ObjectiveType.Displacement: DrawDisplacement((Displacement)objective); break; case ObjectiveType.Projection: DrawProjection((Projection)objective); break; } }
private void InspectObjective(BioObjective objective) { Undo.RecordObject(objective, objective.name); SetGUIColor(Color13); using (new EditorGUILayout.VerticalScope("Box")) { SetGUIColor(Color5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.HelpBox(" Objective (" + objective.GetObjectiveType().ToString() + ") ", MessageType.None); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); SetGUIColor(Color1); objective.enabled = EditorGUILayout.Toggle("Enabled", objective.enabled); SetGUIColor(Color1); objective.Weight = EditorGUILayout.DoubleField("Weight", objective.Weight); switch (objective.GetObjectiveType()) { case ObjectiveType.Position: InspectPosition((Position)objective); break; case ObjectiveType.Orientation: InspectOrientation((Orientation)objective); break; case ObjectiveType.LookAt: InspectLookAt((LookAt)objective); break; case ObjectiveType.Distance: InspectDistance((Distance)objective); break; case ObjectiveType.JointValue: InspectJointValue((JointValue)objective); break; case ObjectiveType.Displacement: InspectDisplacement((Displacement)objective); break; case ObjectiveType.Projection: InspectProjection((Projection)objective); break; } GUI.skin.button.alignment = TextAnchor.MiddleCenter; SetGUIColor(Color7); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove", GUILayout.Width(100f))) { objective.Remove(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } if (objective != null) { EditorUtility.SetDirty(objective); } }
public ObjectivePtr(BioObjective objective, Node node, int index) { Objective = objective; Node = node; Index = index; }