diff --git a/Unity/Assets/Scripts/CharacterSelectionScript/CharacterSelection.cs b/Unity/Assets/Scripts/CharacterSelectionScript/CharacterSelection.cs
index 908545b1f..cdf6b8656 100644
--- a/Unity/Assets/Scripts/CharacterSelectionScript/CharacterSelection.cs
+++ b/Unity/Assets/Scripts/CharacterSelectionScript/CharacterSelection.cs
@@ -3,11 +3,26 @@
using UnityEngine;
using UnityEngine.SceneManagement;
+///
+/// Manages the character selection screen functionality, allowing players to browse and select different characters
+/// before starting the game.
+///
public class CharacterSelection : MonoBehaviour
{
+ ///
+ /// Array containing references to all available character GameObjects that can be selected.
+ /// Only one character should be active at a time.
+ ///
public GameObject[] characters;
+ ///
+ /// Index of the currently selected character in the characters array.
+ ///
public int selectedCharacter = 0;
+ ///
+ /// Switches to the next character in the selection screen.
+ /// Deactivates the current character and activates the next one in a circular manner.
+ ///
public void NextCharacter()
{
characters[selectedCharacter].SetActive(false);
@@ -15,6 +30,10 @@ public void NextCharacter()
characters[selectedCharacter].SetActive(true);
}
+ ///
+ /// Switches to the previous character in the selection screen.
+ /// Deactivates the current character and activates the previous one in a circular manner.
+ ///
public void PreviusCharacter()
{
characters[selectedCharacter].SetActive(false);
@@ -26,6 +45,10 @@ public void PreviusCharacter()
characters[selectedCharacter].SetActive(true);
}
+ ///
+ /// Starts the game with the selected character.
+ /// Saves the selected character index to PlayerPrefs and loads the game scene.
+ ///
public void StartGame()
{
PlayerPrefs.SetInt("selectedCharacter", selectedCharacter);
diff --git a/Unity/Assets/Scripts/CharacterSelectionScript/LoadCharacter.cs b/Unity/Assets/Scripts/CharacterSelectionScript/LoadCharacter.cs
index 19f70e7d9..0e7c0d6c5 100644
--- a/Unity/Assets/Scripts/CharacterSelectionScript/LoadCharacter.cs
+++ b/Unity/Assets/Scripts/CharacterSelectionScript/LoadCharacter.cs
@@ -3,27 +3,46 @@
using UnityEngine;
using TMPro;
+///
+/// Handles the loading and instantiation of character prefabs based on player selection.
+/// This script is used in game scenes where the selected character needs to be spawned.
+/// It reads the player's character selection from PlayerPrefs and instantiates the corresponding prefab.
+///
public class LoadCharacter : MonoBehaviour
{
+ ///
+ /// Array of character prefabs that can be instantiated.
+ /// These should be assigned in the Unity Inspector.
+ ///
public GameObject[] characterPrefab;
+ ///
+ /// Transform reference for the position where the character will be spawned.
+ /// Should be set in the Unity Inspector.
+ ///
public Transform spawnPoint;
+ ///
+ /// TextMeshPro UI component to display the selected character's name.
+ /// Optional - can be left unassigned if character name display is not needed.
+ ///
public TMP_Text label;
- void Start() // Corrige aquí el error de "Star"
+ ///
+ /// Initializes the character loading process when the script starts.
+ /// Retrieves the selected character index from PlayerPrefs and instantiates the corresponding prefab.
+ /// Also updates the character name label if one is assigned.
+ ///
+ void Start()
{
- // Obtén el índice del personaje seleccionado guardado en PlayerPrefs
- int selectedCharacter = PlayerPrefs.GetInt("selectedCharacter", 0); // Usa 0 como valor predeterminado
+ int selectedCharacter = PlayerPrefs.GetInt("selectedCharacter", 0);
if (selectedCharacter < 0 || selectedCharacter >= characterPrefab.Length)
{
- Debug.LogError("Índice de personaje seleccionado está fuera de rango. Verifica los prefabs asignados en el inspector.");
+ Debug.LogError("�ndice de personaje seleccionado est� fuera de rango. Verifica los prefabs asignados en el inspector.");
return;
}
- // Instancia el prefab en el punto de spawn
GameObject prefab = characterPrefab[selectedCharacter];
- GameObject clone = Instantiate(prefab, spawnPoint.position, Quaternion.identity); // Corrige aquí "Quanternion" a "Quaternion"
+ GameObject clone = Instantiate(prefab, spawnPoint.position, Quaternion.identity);
- // Actualiza el texto del nombre del personaje, si está asignado
if (label != null)
{
label.text = prefab.name;
diff --git a/Unity/Assets/Scripts/CharacterSelectionScript/NPCInteraction.cs b/Unity/Assets/Scripts/CharacterSelectionScript/NPCInteraction.cs
index bd13cd686..cab3c8b36 100644
--- a/Unity/Assets/Scripts/CharacterSelectionScript/NPCInteraction.cs
+++ b/Unity/Assets/Scripts/CharacterSelectionScript/NPCInteraction.cs
@@ -2,15 +2,34 @@
using TMPro;
using System.Collections;
+///
+/// Controls NPC dialogue interactions and display of interaction prompts.
+/// This script should be attached to NPC GameObjects to enable player-NPC dialogue interactions.
+///
public class NPCInteraction : MonoBehaviour
{
+ ///
+ /// UI panel that contains the dialogue elements
+ ///
public GameObject dialogueUI;
+ ///
+ /// Text component that displays the NPC's dialogue
+ ///
public TextMeshProUGUI dialogueText;
+ ///
+ /// UI element showing the interaction prompt (e.g., "Press E to interact")
+ ///
public GameObject interactionText;
- public string[] greetings = { "Hola, bienvenido a Citizen of Arcanis!", "¿Qué tal el día?", "¡Es un placer verte!", "Espero que disfrutes tu aventura.", "¿Necesitas ayuda?" };
+ ///
+ /// Array of possible greeting messages that the NPC can display
+ ///
+ public string[] greetings = { "Hola, bienvenido a Citizen of Arcanis!", "�Qu� tal el d�a?", "�Es un placer verte!", "Espero que disfrutes tu aventura.", "�Necesitas ayuda?" };
private bool isPlayerNearby = false;
private Coroutine typingCoroutine;
+ ///
+ /// Initializes the dialogue UI elements to their default hidden state
+ ///
void Start()
{
if (interactionText != null)
@@ -23,6 +42,10 @@ void Start()
}
}
+ ///
+ /// Handles player entering the NPC's interaction zone
+ ///
+ /// The collider that entered the trigger zone
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
@@ -35,6 +58,10 @@ void OnTriggerEnter(Collider other)
}
}
+ ///
+ /// Handles player leaving the NPC's interaction zone
+ ///
+ /// The collider that exited the trigger zone
void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
@@ -56,6 +83,9 @@ void OnTriggerExit(Collider other)
}
}
+ ///
+ /// Checks for player input to trigger dialogue interaction
+ ///
void Update()
{
if (isPlayerNearby && Input.GetKeyDown(KeyCode.E))
@@ -64,6 +94,9 @@ void Update()
}
}
+ ///
+ /// Toggles the dialogue panel visibility and manages the typing animation
+ ///
void TogglePanel()
{
if (dialogueUI != null)
@@ -103,6 +136,11 @@ void TogglePanel()
}
}
+ ///
+ /// Creates a typing animation effect for displaying dialogue text
+ ///
+ /// The message to be displayed character by character
+ /// IEnumerator for the coroutine system
IEnumerator TypeText(string message)
{
dialogueText.text = "";
diff --git a/Unity/Assets/Scripts/DroneMovement/DroneMovement.cs b/Unity/Assets/Scripts/DroneMovement/DroneMovement.cs
index 4542bfd4f..ee08f6fa4 100644
--- a/Unity/Assets/Scripts/DroneMovement/DroneMovement.cs
+++ b/Unity/Assets/Scripts/DroneMovement/DroneMovement.cs
@@ -1,30 +1,47 @@
using UnityEngine;
+///
+/// Controls the circular movement of a drone around a center point.
+/// This script should be attached to a drone GameObject that needs to orbit around a specific point in the scene.
+///
public class DroneMovement : MonoBehaviour
{
+ ///
+ /// Reference to the transform that serves as the center point for the drone's circular movement.
+ ///
public Transform centerPoint;
+ ///
+ /// The radius of the circular path that the drone follows.
+ ///
public float radius = 10f;
+ ///
+ /// The speed at which the drone moves along its circular path.
+ /// Higher values result in faster orbital movement.
+ ///
public float speed = 1f;
+ ///
+ /// The speed at which the drone rotates around its local right axis.
+ ///
public float rotationSpeed = 50f;
-
private float angle = 0f;
+ ///
+ /// Updates the drone's position and rotation each frame.
+ /// Calculates the new position based on circular movement around the center point
+ /// and updates the drone's rotation to face its movement direction.
+ ///
void Update()
{
-
angle += speed * Time.deltaTime;
float x = centerPoint.position.x + Mathf.Cos(angle) * radius;
float z = centerPoint.position.z + Mathf.Sin(angle) * radius;
float y = transform.position.y;
-
transform.position = new Vector3(x, y, z);
-
transform.Rotate(Vector3.right, rotationSpeed * Time.deltaTime);
-
Vector3 direction = new Vector3(x, y, z) - transform.position;
transform.rotation = Quaternion.LookRotation(direction);
}
diff --git a/Unity/Assets/Scripts/Minimap/MinimapController.cs b/Unity/Assets/Scripts/Minimap/MinimapController.cs
index 1f7f63033..edab5f09d 100644
--- a/Unity/Assets/Scripts/Minimap/MinimapController.cs
+++ b/Unity/Assets/Scripts/Minimap/MinimapController.cs
@@ -1,16 +1,27 @@
using UnityEngine;
+///
+/// Controls the minimap camera behavior by following the player's position.
+/// This script should be attached to the minimap camera object in the scene.
+///
public class MinimapController : MonoBehaviour
{
- public Transform player; // El jugador al que seguirá el minimapa
+ ///
+ /// Reference to the player's transform that the minimap camera will follow.
+ /// Must be assigned through the Unity Inspector.
+ ///
+ public Transform player;
+ ///
+ /// Updates the minimap camera position to follow the player.
+ /// Called after all Update functions have been called.
+ ///
private void LateUpdate()
{
- if (player == null) return; // Asegúrate de que el jugador está asignado
+ if (player == null) return;
- // Actualizar la posición de la cámara para que siga al jugador
Vector3 newPosition = player.position;
- newPosition.y = transform.position.y; // Mantener la altura configurada en el Inspector
+ newPosition.y = transform.position.y;
transform.position = newPosition;
}
diff --git a/Unity/Assets/Scripts/RegistrySystem/SaveSystem.cs b/Unity/Assets/Scripts/RegistrySystem/SaveSystem.cs
index ece0e8c39..7d748d7cf 100644
--- a/Unity/Assets/Scripts/RegistrySystem/SaveSystem.cs
+++ b/Unity/Assets/Scripts/RegistrySystem/SaveSystem.cs
@@ -4,43 +4,58 @@
using UnityEngine;
using TMPro;
-
+///
+/// Manages the saving and loading of player data, specifically handling player name storage
+/// using Unity's PlayerPrefs system. This script is typically attached to a UI manager in
+/// scenes where player data needs to be persisted.
+///
public class Save : MonoBehaviour
{
+ ///
+ /// Input field where the player enters their name
+ ///
public TMP_InputField inputField;
- public TMP_Text warningText; // Optional: Warning text in the UI
+ ///
+ /// Text component used to display warning messages to the user
+ ///
+ public TMP_Text warningText;
+ ///
+ /// Text component that displays the current player name
+ ///
public TMP_Text playerNameText;
+ ///
+ /// Saves the player's name to PlayerPrefs if the input field is not empty.
+ /// Displays a warning message if no name is entered.
+ ///
public void SaveData()
{
string playerName = inputField.text;
- // Check if the text field is empty
if (string.IsNullOrEmpty(playerName))
{
- // If empty, display warning and do not save
Debug.LogWarning("The name field is empty. Please enter a name.");
- // Display warning message in UI if exists
if (warningText != null)
{
warningText.text = "Please enter your name before saving.";
}
- return; // Exit method without saving
}
- // Save the name in PlayerPrefs
PlayerPrefs.SetString("PlayerName", playerName);
PlayerPrefs.Save();
Debug.Log("Saved name: " + playerName);
- // Clear warning message if saved correctly
if (warningText != null)
{
warningText.text = "";
}
}
- // Method for loading data
+
+ ///
+ /// Loads the previously saved player name from PlayerPrefs and displays it
+ /// in the input field. Shows a warning if no data exists.
+ ///
public void LoadData()
{
if (PlayerPrefs.HasKey("PlayerName"))
@@ -54,6 +69,10 @@ public void LoadData()
}
}
+ ///
+ /// Deletes the stored player name from PlayerPrefs and clears the input field.
+ /// Shows a warning if no data exists to delete.
+ ///
public void DeleteData()
{
if (PlayerPrefs.HasKey("PlayerName"))
@@ -68,7 +87,10 @@ public void DeleteData()
}
}
- // Method for loading the character selection scene
+ ///
+ /// Transitions the game to the character selection scene.
+ /// This method is typically called after the player's name has been saved.
+ ///
public void LoadCharacterSelectionScene()
{
SceneManager.LoadScene("DemoSelectionCharacter");
diff --git a/Unity/Assets/Scripts/RegistrySystem/ShowNameOtherScene.cs b/Unity/Assets/Scripts/RegistrySystem/ShowNameOtherScene.cs
index 68d82816d..93d8dfb1e 100644
--- a/Unity/Assets/Scripts/RegistrySystem/ShowNameOtherScene.cs
+++ b/Unity/Assets/Scripts/RegistrySystem/ShowNameOtherScene.cs
@@ -2,25 +2,34 @@
using TMPro;
using UnityEngine.SceneManagement;
+///
+/// Manages the display of the player's name across different scenes in the game.
+/// This script is responsible for retrieving the stored player name and displaying it
+/// with different formats depending on the current scene.
+///
public class ShowNameOtherScene : MonoBehaviour
{
+ ///
+ /// Reference to the TextMeshPro component that will display the player's name.
+ /// This must be assigned in the Unity Inspector.
+ ///
public TMP_Text playerNameTetx;
+ ///
+ /// Initializes the player name display when the script starts.
+ /// Retrieves the player name from PlayerPrefs and formats it according to the current scene.
+ ///
void Start()
{
- // Load player name from PlayerPrefs
string playerName = PlayerPrefs.GetString("PlayerName", "Player");
playerNameTetx.text = playerName;
- // Verificar si estamos en la escena de selección de personaje
if (SceneManager.GetActiveScene().name == "DemoSelectionCharacter")
{
- // Mostrar "Welcome, [Nombre]" solo en la escena de selección de personaje
playerNameTetx.text = "Welcome, " + playerName;
}
else
{
- // Mostrar solo el nombre en otras escenas
playerNameTetx.text = playerName;
}
}
diff --git a/Unity/Assets/Scripts/WeaponsScripts/AtivationWeapons.cs b/Unity/Assets/Scripts/WeaponsScripts/AtivationWeapons.cs
index e500b7152..b5cd2efe8 100644
--- a/Unity/Assets/Scripts/WeaponsScripts/AtivationWeapons.cs
+++ b/Unity/Assets/Scripts/WeaponsScripts/AtivationWeapons.cs
@@ -2,30 +2,43 @@
using System.Collections.Generic;
using UnityEngine;
+///
+/// Manages the activation of weapons when the player collects them in the game world.
+/// This script should be attached to weapon pickup objects in the scene.
+///
public class ActivationSword : MonoBehaviour
{
- public int weaponNumber; // Número de la espada que este objeto representa
+ ///
+ /// Identifier number for the weapon this object represents.
+ /// This number should match the weapon index in the CollectionWeapons component.
+ ///
+ public int weaponNumber;
+ ///
+ /// Reference to the CollectionWeapons component that manages the player's weapon inventory.
+ ///
private CollectionWeapons collectionWeapons;
-
+ ///
+ /// Handles the collision between the player and the weapon pickup object.
+ /// When triggered, activates the corresponding weapon in the player's inventory
+ /// and destroys the pickup object.
+ ///
+ /// The Collider that entered this object's trigger zone
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
- // Intentar obtener CollectionWeapons en el momento de la colisión
CollectionWeapons collectionWeapons = other.GetComponentInChildren();
if (collectionWeapons == null)
{
Debug.LogError("CollectionWeapons component not found on the Player or its children.");
- return; // Salir del método si CollectionWeapons es nulo
+ return;
}
- // Activar el arma correspondiente
collectionWeapons.ActivationWeapon(weaponNumber);
Debug.Log($"Weapon {weaponNumber} activated.");
- // Destruir el objeto que representa la espada en el suelo
Destroy(gameObject);
}
}
diff --git a/Unity/Assets/Scripts/WeaponsScripts/CollectionWeapons.cs b/Unity/Assets/Scripts/WeaponsScripts/CollectionWeapons.cs
index a501bf2b9..f82cb622c 100644
--- a/Unity/Assets/Scripts/WeaponsScripts/CollectionWeapons.cs
+++ b/Unity/Assets/Scripts/WeaponsScripts/CollectionWeapons.cs
@@ -2,27 +2,37 @@
using System.Collections.Generic;
using UnityEngine;
+///
+/// Manages a collection of weapon GameObjects in the game.
+/// This script handles the activation and deactivation of different weapons
+/// typically attached to a player or weapon manager object.
+///
public class CollectionWeapons : MonoBehaviour
{
- public GameObject[] weapons; // Array of weapons (swords, etc.)
+ ///
+ /// Array containing all available weapon GameObjects.
+ /// Each element represents a different weapon (sword, axe, etc.) that can be activated.
+ ///
+ public GameObject[] weapons;
- // Method to activate a specific sword
+ ///
+ /// Activates a specific weapon and deactivates all others.
+ /// Used when switching between different weapons in the game.
+ ///
+ /// The index of the weapon to activate (0-based index)
public void ActivationWeapon(int number)
{
- // Validate that the index is within the weapon range
if (number < 0 || number >= weapons.Length)
{
Debug.LogError($"Invalid weapon number: {number}. Must be between 0 and {weapons.Length - 1}.");
return;
}
- // Deactivate all weapons
for (int i = 0; i < weapons.Length; i++)
{
weapons[i].SetActive(false);
}
- // Activate only the desired sword
weapons[number].SetActive(true);
Debug.Log($"Weapon {number} activated.");
}