diff --git a/Assets/Scripts/.ChangeColour.cs.swp b/Assets/Scripts/.ChangeColour.cs.swp deleted file mode 100644 index ec7e51864527ee8537cace1ce5f147b182c5a3ca..0000000000000000000000000000000000000000 Binary files a/Assets/Scripts/.ChangeColour.cs.swp and /dev/null differ diff --git a/Assets/Scripts/.ExperimentController.cs.swp b/Assets/Scripts/.ExperimentController.cs.swp deleted file mode 100644 index df0e29288dd997ed2b25b509f18772fdbb358d2b..0000000000000000000000000000000000000000 Binary files a/Assets/Scripts/.ExperimentController.cs.swp and /dev/null differ diff --git a/Assets/Scripts/.GameController.cs.swp b/Assets/Scripts/.GameController.cs.swp deleted file mode 100644 index d35dba833d72cf4b1059eeed6d6a601b17143332..0000000000000000000000000000000000000000 Binary files a/Assets/Scripts/.GameController.cs.swp and /dev/null differ diff --git a/Assets/Scripts/.GameController.cs.un~ b/Assets/Scripts/.GameController.cs.un~ index af7ba5803a7d6b371cbd7bcf27cb7c359304dc90..cd41cc034fe43cc04803f749f3e5f19e449cc2a8 100644 Binary files a/Assets/Scripts/.GameController.cs.un~ and b/Assets/Scripts/.GameController.cs.un~ differ diff --git a/Assets/Scripts/.TriggerBoundary.cs.swp b/Assets/Scripts/.TriggerBoundary.cs.swp deleted file mode 100644 index d37ab7f9708bfd10ca665082a6afeeb6869e5c95..0000000000000000000000000000000000000000 Binary files a/Assets/Scripts/.TriggerBoundary.cs.swp and /dev/null differ diff --git a/Assets/Scripts/.TriggerBoundary.cs.un~ b/Assets/Scripts/.TriggerBoundary.cs.un~ index f881f53701690bdf912f23bc6da8ce2225e3d3ed..c19c65439343237ac2260c55a70386cf9fba66fb 100644 Binary files a/Assets/Scripts/.TriggerBoundary.cs.un~ and b/Assets/Scripts/.TriggerBoundary.cs.un~ differ diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index fd39e731c40f6a50c9c76a8ab840cd8fbce2e303..7098da681ab9da68b08461502e99a8d4a7e93e39 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -47,7 +47,7 @@ public class GameController : MonoBehaviour private const int NumGoals = 2; // If exceeds this time including hold time, then the player loses - private const int FailTime = 4000; + private const int FailTime = 3500; // Player must keep their sprite in the goal for this long in order to complete the task private const int HoldTime = 1000; // Time the player must spend in the base to be considered end of trial @@ -139,8 +139,7 @@ public class GameController : MonoBehaviour // If the player hasn't achieved the hold time in the allotted time // they fail - if (Timer > FailTime) - { + if (FailConditions()) { TrialResult = false; TrialState = false; } @@ -177,7 +176,6 @@ public class GameController : MonoBehaviour // base position if ( BaseTriggerBoundary.GetStayTime() >= (float)BaseHoldTime/1e3 ) { EndTrialSequence(); - Debug.Log("End complete"); } } } @@ -242,8 +240,6 @@ public class GameController : MonoBehaviour { GoalsChangeColour[GoalSet].GoalState = 0; Timer = 0; - // THERE IS A BUG HERE, LOOK TO FIX, WHY CAN'T I CREATE ARRAYS OF - // CLASS OBJECTS? mExperimentCtrl[ExperimentTrial].Index = ExperimentTrial; mExperimentCtrl[ExperimentTrial].TrialResult = TrialResult; ExperimentTrial++; @@ -252,7 +248,14 @@ public class GameController : MonoBehaviour // Check for any fail conditions here // Incl: Taking too long to finish, leaving early (disqualification) private bool FailConditions() { - return true; + float goTime = mTimingSetting.TrialStart + mTimingSetting.TargetOnset + + OnsetDev; + bool base_exit = BaseTriggerBoundary.ExitColliderIsTriggered; + if (Timer > FailTime || (Timer < goTime && base_exit)) + { + return true; + } + return false; } } diff --git a/Assets/Scripts/GameController.cs~ b/Assets/Scripts/GameController.cs~ index 91c49088b03a1d82cc4ec11a0613f96316be675d..72659e217c269913416a8dada9e5197f4553ab94 100644 --- a/Assets/Scripts/GameController.cs~ +++ b/Assets/Scripts/GameController.cs~ @@ -139,8 +139,7 @@ public class GameController : MonoBehaviour // If the player hasn't achieved the hold time in the allotted time // they fail - if (Timer > FailTime) - { + if (FailConditions()) { TrialResult = false; TrialState = false; } @@ -156,8 +155,8 @@ public class GameController : MonoBehaviour + DestTriggerBoundary.name + "\tDestStayTime: " + DestTriggerBoundary.GetStayTime().ToString() + "\nmExpCtrl-1: " + - mExperimentCtrl[ExperimentTrial].Index.ToString() + "\t" + - mExperimentCtrl[ExperimentTrial].TrialResult.ToString(); + mExperimentCtrl[ExperimentTrial-1].Index.ToString() + "\t" + + mExperimentCtrl[ExperimentTrial-1].TrialResult.ToString(); } else { @@ -177,7 +176,6 @@ public class GameController : MonoBehaviour // base position if ( BaseTriggerBoundary.GetStayTime() >= (float)BaseHoldTime/1e3 ) { EndTrialSequence(); - Debug.Log("End complete"); } } } @@ -242,8 +240,6 @@ public class GameController : MonoBehaviour { GoalsChangeColour[GoalSet].GoalState = 0; Timer = 0; - // THERE IS A BUG HERE, LOOK TO FIX, WHY CAN'T I CREATE ARRAYS OF - // CLASS OBJECTS? mExperimentCtrl[ExperimentTrial].Index = ExperimentTrial; mExperimentCtrl[ExperimentTrial].TrialResult = TrialResult; ExperimentTrial++; @@ -252,7 +248,14 @@ public class GameController : MonoBehaviour // Check for any fail conditions here // Incl: Taking too long to finish, leaving early (disqualification) private bool FailConditions() { - return true; + float goTime = mTimingSetting.TrialStart + mTimingSetting.TargetOnset + + OnsetDev; + bool base_exit = BaseTriggerBoundary.ExitColliderIsTriggered; + if (Timer > FailTime || (Timer < goTime && base_exit)) + { + return true; + } + return false; } } diff --git a/Assets/Scripts/TriggerBoundary.cs b/Assets/Scripts/TriggerBoundary.cs index 98ed631350ea03a21caf36da53bd68d2495e4e28..9cae81b1d26f3e7c58d757cd06bb5fd7baad3e2d 100644 --- a/Assets/Scripts/TriggerBoundary.cs +++ b/Assets/Scripts/TriggerBoundary.cs @@ -5,6 +5,7 @@ using UnityEngine; public class TriggerBoundary : MonoBehaviour { public bool ColliderIsTriggered { get; private set; } + public bool ExitColliderIsTriggered { get; private set; } private float time; @@ -17,12 +18,14 @@ public class TriggerBoundary : MonoBehaviour void OnTriggerStay2D(Collider2D collider) { ColliderIsTriggered = true; + ExitColliderIsTriggered = false; time += Time.deltaTime; } void OnTriggerExit2D() { ColliderIsTriggered = false; + ExitColliderIsTriggered = true; time = 0.0f; } diff --git a/Assets/Scripts/TriggerBoundary.cs~ b/Assets/Scripts/TriggerBoundary.cs~ index 64bb3d448c73c96eddc22236498527179fbd04c9..98ed631350ea03a21caf36da53bd68d2495e4e28 100644 --- a/Assets/Scripts/TriggerBoundary.cs~ +++ b/Assets/Scripts/TriggerBoundary.cs~ @@ -17,7 +17,7 @@ public class TriggerBoundary : MonoBehaviour void OnTriggerStay2D(Collider2D collider) { ColliderIsTriggered = true; - time += Time.deltaTime/1e3; + time += Time.deltaTime; } void OnTriggerExit2D()