Skip to content

Commit

Permalink
Update XML documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
greasycat committed May 30, 2024
1 parent 0d776cd commit 982e7bb
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 23 deletions.
19 changes: 14 additions & 5 deletions Assets/LandmarksR/Scripts/Animation/LightColorAnimate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@

namespace LandmarksR.Scripts.Animation
{
/// <summary>
/// Animates the color of a light component through a rainbow spectrum.
/// </summary>
public class LightColorAnimate : MonoBehaviour
{
/// <summary>
/// The speed of the color change animation.
/// </summary>
public float speed = 2f;
public Color color = Color.white;

private Light _light;
private float _time;

/// <summary>
/// Initializes the light component.
/// </summary>
private void Start()
{
_light = GetComponent<Light>();
}

/// <summary>
/// Updates the light color each frame.
/// </summary>
private void Update()
{
_time += Time.deltaTime * speed * 0.05f;

// rainbow color
// Update the light color to a rainbow color.
_light.color = Color.HSVToRGB(Mathf.PingPong(_time, 1), 1, 1);

// _light.color = Color.Lerp(Color.white, color, Mathf.PingPong(_time, 1));

}
}
}
13 changes: 13 additions & 0 deletions Assets/LandmarksR/Scripts/Animation/RotateAnimate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@

namespace LandmarksR.Scripts.Animation
{
/// <summary>
/// Rotates the GameObject around a specified axis at a specified speed.
/// </summary>
public class RotateAnimate : MonoBehaviour
{
/// <summary>
/// The speed of the rotation.
/// </summary>
public float speed = 2f;

/// <summary>
/// The axis around which the GameObject will rotate.
/// </summary>
public Vector3 axis = Vector3.forward;

/// <summary>
/// Updates the rotation of the GameObject each frame.
/// </summary>
private void Update()
{
// Rotate the object around its local axis
Expand Down
23 changes: 22 additions & 1 deletion Assets/LandmarksR/Scripts/Attributes/NotEditableAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,36 @@
namespace LandmarksR.Scripts.Attributes
{
#if UNITY_EDITOR
/// <summary>
/// Attribute to make a property not editable in the Unity Inspector.
/// </summary>
public class NotEditableAttribute : PropertyAttribute
{
}

/// <summary>
/// Custom property drawer for the NotEditableAttribute.
/// </summary>
[CustomPropertyDrawer(typeof(NotEditableAttribute))]
public sealed class NotEditableDrawer : PropertyDrawer
{
/// <summary>
/// Gets the height of the property.
/// </summary>
/// <param name="property">The serialized property.</param>
/// <param name="label">The label of the property.</param>
/// <returns>The height of the property.</returns>
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}

/// <summary>
/// Renders the property in the Unity Inspector.
/// </summary>
/// <param name="position">The position to render the property.</param>
/// <param name="property">The serialized property.</param>
/// <param name="label">The label of the property.</param>
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginDisabledGroup(true);
Expand All @@ -24,7 +42,10 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
}
}
#else
public class NotEditableAttribute: System.Attribute
/// <summary>
/// Attribute to make a property not editable.
/// </summary>
public class NotEditableAttribute : System.Attribute
{
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions Assets/LandmarksR/Scripts/Editor/CreateMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ namespace LandmarksR.Scripts.Editor
{
public static class CreateMenuItem
{
/// <summary>
/// Creates a new GameObject with a specified component attached to it.
/// This is a help method to create a GameObject with a component attached to it.
/// Check Assets/LandmarksR/Scripts/Tasks/Editor/hierarchyMenu.cs for example usage.
/// </summary>
/// <param name="menuCommand"></param>
/// <param name="name"></param>
/// <typeparam name="T"></typeparam>
public static void CreateGameObjectContextMenu<T>(MenuCommand menuCommand, string name) where T: Component
{
var go = new GameObject(name);
Expand Down
3 changes: 3 additions & 0 deletions Assets/LandmarksR/Scripts/Editor/DataUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace LandmarksR.Scripts.Editor
{
public class DataUtility: EditorWindow
{
/// <summary>
/// Opens the data folder in the file explorer.
/// </summary>
[MenuItem("LandmarksR/Open Data Folder")]
private static void OpenDataFolder()
{
Expand Down
3 changes: 3 additions & 0 deletions Assets/LandmarksR/Scripts/Editor/ExpandInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ namespace LandmarksR.Scripts.Editor
{
public class ExpandInspector: EditorWindow
{
/// <summary>
/// Expands the selected GameObject in the Hierarchy window.
/// </summary>
[MenuItem("EditorUtility/Shortcuts/Expand Selected Tasks &q")]
//https://stackoverflow.com/a/66366775
private static void ExpandTasks()
Expand Down
4 changes: 4 additions & 0 deletions Assets/LandmarksR/Scripts/Editor/SetUid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

namespace LandmarksR.Scripts.Editor
{
/// <summary>
/// Assigns a unique identifier to all tasks in the scene.
/// Currently, not in use.
/// </summary>
public class SetUid : EditorWindow
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace LandmarksR.Scripts.Experiment.Data.Editor
{
/// <summary>
/// Custom property drawer for the DelimiterOption class.
/// </summary>
[CustomPropertyDrawer(typeof(DelimiterOption))]
public class DelimiterOptionDrawer : PropertyDrawer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace LandmarksR.Scripts.Experiment.Data.Editor
{
/// <summary>
/// Custom Unity Inspector for the TextTable class.
/// </summary>
[CustomEditor(typeof(TextTable))]
public class TextTableEditor : UnityEditor.Editor
{
Expand Down
59 changes: 46 additions & 13 deletions Docfx/docs/.obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,44 @@
"state": {
"type": "image",
"state": {
"file": "images/RepeatTask.png"
"file": "images/create_root_task.png"
}
}
},
{
"id": "63aa1592bcbbaf9a",
"type": "leaf",
"state": {
"type": "image",
"state": {
"file": "images/calibration_prefabs.png"
}
}
},
{
"id": "560b3d41b28230f4",
"type": "leaf",
"state": {
"type": "image",
"state": {
"file": "images/calibration_prefabs.png"
}
}
},
{
"id": "293fd5a5cc0ac185",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "landmarks_r_structure.md",
"mode": "source",
"source": true
}
}
}
],
"currentTab": 1
"currentTab": 4
}
],
"direction": "vertical"
Expand Down Expand Up @@ -96,7 +128,7 @@
"state": {
"type": "backlink",
"state": {
"file": "images/RepeatTask.png",
"file": "landmarks_r_structure.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
Expand All @@ -113,7 +145,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "images/RepeatTask.png",
"file": "landmarks_r_structure.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
Expand All @@ -136,7 +168,7 @@
"state": {
"type": "outline",
"state": {
"file": "images/RepeatTask.png"
"file": "landmarks_r_structure.md"
}
}
}
Expand All @@ -157,18 +189,19 @@
"command-palette:Open command palette": false
}
},
"active": "99a8680c970a034c",
"active": "293fd5a5cc0ac185",
"lastOpenFiles": [
"introduction.md",
"data.md",
"core_components.md",
"landmarks_r_structure.md",
"images/calibration_prefabs.png",
"images/create_landmarks_r.png",
"images/create_root_task.png",
"images/RepeatTask.png",
"Unit Testing.md",
"Quest Calibration.md",
"Quick Introduction to Quest.md",
"landmarks_r_structure.md",
"introduction.md",
"core_components.md",
"calibration_prefabs.png",
"create_root_task.png",
"create_landmarks_r.png",
"data.md",
"images/framework_unity_structure.png",
"tasks.md",
"2. Core Components.md"
Expand Down
9 changes: 6 additions & 3 deletions Docfx/docs/core_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ All these components are initialized before any tasks. You will frequently refer
### Step 1: Create a `GameObject` Called "LandmarksR"
- Create a new GameObject and name it "LandmarksR".
- Click on `Add Component` and add the `Experiment` script.
![Create LandmarksR](create_landmarks_r.png)

![Create LandmarksR](images/create_landmarks_r.png)

### Step 2: Add `PlayerController`
- In the Project Explorer, navigate to `Assets/LandmarksR/Prefabs/Core`.
Expand All @@ -69,7 +70,8 @@ All these components are initialized before any tasks. You will frequently refer
- Create an empty root task by right-clicking on the "LandmarksR" GameObject.
- Navigate to `Experiment/Tasks/1.RootTask` and click on `RootTask` to create it.
- Remember to change the tag of this GameObject to `RootTask`.
![Create RootTask](create_root_task.png)

![Create RootTask](images/create_root_task.png)

### Step 5 (Optional): Create Settings and Experiment Logger
- Create a new GameObject called "Settings" and add the `Settings` script to it. Refer to the settings page for more configuration information.
Expand All @@ -82,4 +84,5 @@ All these components are initialized before any tasks. You will frequently refer
### Step Ex.2: Add Calibration Space and Calibration Task (VR)
- Drag and drop the `CalibrationTask` under `RootTask`, ensuring it is the **first** task.
- Drag and drop the `Calibration Space` into the "LandmarksR" GameObject (not under the "Environment").
![Calibration Prefabs](calibration_prefabs.png)

![Calibration Prefabs](images/calibration_prefabs.png)
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion Docfx/docs/landmarks_r_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Let's first break down the framework structure inside the Unity Editor

# Overall Structure
Here's a screenshot of that
Here's a screenshot of an project

![](images/framework_unity_structure.png)

| GameObject | Required By LandmarksR | Purpose | Assigned/Required Tag |
Expand Down

0 comments on commit 982e7bb

Please sign in to comment.