Serious Game - Electrónica VR 1.0.0
Loading...
Searching...
No Matches
GameManager Class Reference

Controlador principal del juego. Gestiona los 4 retos del Serious Game VR. Usa eventos para comunicarse con UI y otros sistemas (sin acoplamiento directo). More...

Inheritance diagram for GameManager:
Inheritance graph
Collaboration diagram for GameManager:
Collaboration graph

Public Member Functions

void RegisterRepairAction ()
 Registra que se realizó una reparación y resimula el circuito.
void RegisterWrongAttempt (string reason="")
 Registra un intento incorrecto del Técnico.
bool HasPerformedRepair ()
int GetWrongAttempts ()
void NextLevel ()
void RestartCurrentLevel ()
 Reinicia el reto actual desde cero (conserva el índice).
void GoToLevel (int index)
 Salta directamente a un reto. Solo funciona con _debugMode activo.
bool IsVoltageCorrect ()

Public Attributes

CircuitManager circuit
Multimeter multimeter
PerformanceTracker performance
InstructionSystem instructionSystem
GameObject reto1Zone
GameObject reto2Zone
GameObject reto3Zone
GameObject reto4Zone
float zoneTransitionDelay = 3f
float[] timeLimits = { 480f, 600f, 720f, 900f }

Properties

LevelType currentLevel [get]
bool levelCompleted [get]
float currentTimeLimit [get]
float remainingTime [get]
bool timerActive [get]

Events

static Action< LevelTypeOnLevelLoaded
static Action< LevelType, bool > OnLevelCompleted
static Action< string > OnFaultDetected
static Action OnGameCompleted
static Action< float > OnTimerTick
static Action< LevelTypeOnTimerExpired
static Action< int > OnZoneActivated
 Zona activada: índice 0-3. Útil para UI y efectos de transición.
static Action< LevelType, bool > OnZoneTransitionStart
 Disparado justo antes de cargar el siguiente reto.

Private Member Functions

void Awake ()
void Start ()
void Update ()
void OnDestroy ()
void LoadLevel (int index)
void SetupLevel ()
void ActivateComponentsForLevel (LevelType level)
 Activa solo los componentes necesarios para el reto actual. Desactiva los demás para evitar que interfieran con la simulación.
void SetupReto1 ()
void CheckReto1 ()
void SetupReto2 ()
void CheckReto2 ()
void SetupReto3 ()
void SetupMixedNodeVoltages ()
void CheckReto3 ()
void SetupReto4 ()
void CheckReto4 ()
void CheckWinCondition ()
 Se llama automáticamente cada vez que el circuito cambia.
void CompleteLevel (bool success)
IEnumerator TransitionToNextLevel ()
void CompleteGame ()
void ValidateZones ()

Private Attributes

bool _debugMode = false
LevelType _currentLevel = LevelType.OhmLaw
int _currentIndex = 0
bool _levelCompleted = false
bool _repairPerformed = false
int _wrongAttempts = 0
float _remainingTime = 0f
bool _timerActive = false

Static Private Attributes

const float RETO1_FAULTY_RESISTANCE = 10f
const float RETO1_CORRECT_RESISTANCE = 100f
const float RETO1_LED_RESISTANCE = 50f
const float RETO1_SOURCE_VOLTAGE = 9f
const float RETO1_TARGET_VOLTAGE = 9f
const float RETO1_TOLERANCE = 0.5f
const float RETO2_BROKEN_RESISTANCE = 9999f
const float RETO2_NORMAL_RESISTANCE = 50f
const float RETO3_FAULTY_RESISTANCE = 470f
const float RETO3_CORRECT_RESISTANCE = 220f

Detailed Description

Controlador principal del juego. Gestiona los 4 retos del Serious Game VR. Usa eventos para comunicarse con UI y otros sistemas (sin acoplamiento directo).

Niveles: 1) Ohm's Law: Circuito serie con resistencia defectuosa. 2) Parallel: Circuito paralelo con una rama abierta. 3) Mixed: Circuito mixto con LED y capacitor con polaridad invertida + resistencia errónea. 4) Arduino: Sensor conectado al pin incorrecto + buzzer sin resistencia + cable suelto.

Member Function Documentation

◆ ActivateComponentsForLevel()

void GameManager.ActivateComponentsForLevel ( LevelType level)
private

Activa solo los componentes necesarios para el reto actual. Desactiva los demás para evitar que interfieran con la simulación.

◆ Awake()

void GameManager.Awake ( )
private

◆ CheckReto1()

void GameManager.CheckReto1 ( )
private

◆ CheckReto2()

void GameManager.CheckReto2 ( )
private

◆ CheckReto3()

void GameManager.CheckReto3 ( )
private

◆ CheckReto4()

void GameManager.CheckReto4 ( )
private

◆ CheckWinCondition()

void GameManager.CheckWinCondition ( )
private

Se llama automáticamente cada vez que el circuito cambia.

◆ CompleteGame()

void GameManager.CompleteGame ( )
private

◆ CompleteLevel()

void GameManager.CompleteLevel ( bool success)
private

◆ GetWrongAttempts()

int GameManager.GetWrongAttempts ( )

◆ GoToLevel()

void GameManager.GoToLevel ( int index)

Salta directamente a un reto. Solo funciona con _debugMode activo.

◆ HasPerformedRepair()

bool GameManager.HasPerformedRepair ( )

◆ IsVoltageCorrect()

bool GameManager.IsVoltageCorrect ( )

◆ LoadLevel()

void GameManager.LoadLevel ( int index)
private

◆ NextLevel()

void GameManager.NextLevel ( )

◆ OnDestroy()

void GameManager.OnDestroy ( )
private

◆ RegisterRepairAction()

void GameManager.RegisterRepairAction ( )

Registra que se realizó una reparación y resimula el circuito.

◆ RegisterWrongAttempt()

void GameManager.RegisterWrongAttempt ( string reason = "")

Registra un intento incorrecto del Técnico.

◆ RestartCurrentLevel()

void GameManager.RestartCurrentLevel ( )

Reinicia el reto actual desde cero (conserva el índice).

◆ SetupLevel()

void GameManager.SetupLevel ( )
private

◆ SetupMixedNodeVoltages()

void GameManager.SetupMixedNodeVoltages ( )
private

◆ SetupReto1()

void GameManager.SetupReto1 ( )
private

◆ SetupReto2()

void GameManager.SetupReto2 ( )
private

◆ SetupReto3()

void GameManager.SetupReto3 ( )
private

◆ SetupReto4()

void GameManager.SetupReto4 ( )
private

◆ Start()

void GameManager.Start ( )
private

◆ TransitionToNextLevel()

IEnumerator GameManager.TransitionToNextLevel ( )
private

◆ Update()

void GameManager.Update ( )
private

◆ ValidateZones()

void GameManager.ValidateZones ( )
private

Member Data Documentation

◆ _currentIndex

int GameManager._currentIndex = 0
private

◆ _currentLevel

LevelType GameManager._currentLevel = LevelType.OhmLaw
private

◆ _debugMode

bool GameManager._debugMode = false
private

◆ _levelCompleted

bool GameManager._levelCompleted = false
private

◆ _remainingTime

float GameManager._remainingTime = 0f
private

◆ _repairPerformed

bool GameManager._repairPerformed = false
private

◆ _timerActive

bool GameManager._timerActive = false
private

◆ _wrongAttempts

int GameManager._wrongAttempts = 0
private

◆ circuit

CircuitManager GameManager.circuit

◆ instructionSystem

InstructionSystem GameManager.instructionSystem

◆ multimeter

Multimeter GameManager.multimeter

◆ performance

PerformanceTracker GameManager.performance

◆ RETO1_CORRECT_RESISTANCE

const float GameManager.RETO1_CORRECT_RESISTANCE = 100f
staticprivate

◆ RETO1_FAULTY_RESISTANCE

const float GameManager.RETO1_FAULTY_RESISTANCE = 10f
staticprivate

◆ RETO1_LED_RESISTANCE

const float GameManager.RETO1_LED_RESISTANCE = 50f
staticprivate

◆ RETO1_SOURCE_VOLTAGE

const float GameManager.RETO1_SOURCE_VOLTAGE = 9f
staticprivate

◆ RETO1_TARGET_VOLTAGE

const float GameManager.RETO1_TARGET_VOLTAGE = 9f
staticprivate

◆ RETO1_TOLERANCE

const float GameManager.RETO1_TOLERANCE = 0.5f
staticprivate

◆ reto1Zone

GameObject GameManager.reto1Zone

◆ RETO2_BROKEN_RESISTANCE

const float GameManager.RETO2_BROKEN_RESISTANCE = 9999f
staticprivate

◆ RETO2_NORMAL_RESISTANCE

const float GameManager.RETO2_NORMAL_RESISTANCE = 50f
staticprivate

◆ reto2Zone

GameObject GameManager.reto2Zone

◆ RETO3_CORRECT_RESISTANCE

const float GameManager.RETO3_CORRECT_RESISTANCE = 220f
staticprivate

◆ RETO3_FAULTY_RESISTANCE

const float GameManager.RETO3_FAULTY_RESISTANCE = 470f
staticprivate

◆ reto3Zone

GameObject GameManager.reto3Zone

◆ reto4Zone

GameObject GameManager.reto4Zone

◆ timeLimits

float [] GameManager.timeLimits = { 480f, 600f, 720f, 900f }

◆ zoneTransitionDelay

float GameManager.zoneTransitionDelay = 3f

Property Documentation

◆ currentLevel

LevelType GameManager.currentLevel
get

◆ currentTimeLimit

float GameManager.currentTimeLimit
get

◆ levelCompleted

bool GameManager.levelCompleted
get

◆ remainingTime

float GameManager.remainingTime
get

◆ timerActive

bool GameManager.timerActive
get

Event Documentation

◆ OnFaultDetected

Action<string> GameManager.OnFaultDetected
static

◆ OnGameCompleted

Action GameManager.OnGameCompleted
static

◆ OnLevelCompleted

Action<LevelType, bool> GameManager.OnLevelCompleted
static

◆ OnLevelLoaded

Action<LevelType> GameManager.OnLevelLoaded
static

◆ OnTimerExpired

Action<LevelType> GameManager.OnTimerExpired
static

◆ OnTimerTick

Action<float> GameManager.OnTimerTick
static

◆ OnZoneActivated

Action<int> GameManager.OnZoneActivated
static

Zona activada: índice 0-3. Útil para UI y efectos de transición.

◆ OnZoneTransitionStart

Action<LevelType, bool> GameManager.OnZoneTransitionStart
static

Disparado justo antes de cargar el siguiente reto.


The documentation for this class was generated from the following file: