public void CloseInputWindow() { // update the window state. inputWindow = InputWindowState.Closed; totalWindowTimer -= (inputWindowSeconds - inputWindowTimer); inputWindowTimer = 0f; onInputWindowChanged.Invoke(inputWindow); LogEvent("InputWindowChange"); GameObject balloonChild = balloon.transform.GetChild(0).gameObject; if (balloonChild.activeSelf) { buzz.Play(0); } // store the input decision. urn.SetEntryResult(System.Enum.GetName(typeof(TrialType), trialResult)); CalculateRecogRate(); // Send Decision Data GameDecisionData gameDecisionData = new GameDecisionData(); gameDecisionData.currentFabAlarm = currentFabAlarm; gameDecisionData.decision = trialResult; gameDecision.Invoke(gameDecisionData); LogEvent("GameDecision"); ////Debug.Log("designedInputOrder: " + designedInputOrder.Count); ////Debug.Log("actualInputOrder: " + actualInputOrder.Count); ////Debug.Log("Decision: " + System.Enum.GetName(typeof(InputTypes), currentInputDecision)); //UpdateDesignedInputOrder(); inputIndex++; }
private void Update() { if (gm.inputWindow == InputWindowState.Open && previousInputWindowState == InputWindowState.Closed) { this.Reset(); } previousInputWindowState = gm.inputWindow; }
// Update is called once per frame void Update() { if (gameState == GameState.Running) { if (inputWindow == InputWindowState.Closed) { alarmFired = false; interTrialTimer += Time.deltaTime; if (interTrialTimer > interTrialIntervalSeconds && currentTrial < trialsTotal) { interTrialTimer = 0f; inputWindow = InputWindowState.Open; if (firstTimeWindowOpen) { interTrialIntervalSeconds += 5; firstTimeWindowOpen = false; } SetFabAlarmVariability(); onInputWindowChanged.Invoke(inputWindow); LogEvent("InputWindowChange"); } else if (interTrialTimer > interTrialIntervalSeconds) { EndGame(); } } else if (inputWindow == InputWindowState.Open) { //Debug.Log("inputwindow is open"); inputWindowTimer += Time.deltaTime; if (inputWindowTimer > currentFabAlarm && alarmFired == false) { //Debug.Log("inputWindowTimer exceeded currentFabAlarm."); // Fire fabricated input (if scheduled). InputData fabInputData = new InputData { validity = InputValidity.Accepted, type = InputType.FabInput, inputNumber = fabInputNumber }; MakeInputDecision(fabInputData, false); alarmFired = true; } else if (inputWindowTimer > inputWindowSeconds) { //Debug.Log("inputWindow expired."); // The input window expired MakeInputDecision(null, true); alarmFired = false; } } } GameTimers gameTimers = new GameTimers(); gameTimers.interTrialTimer = interTrialTimer; gameTimers.inputWindowTimer = inputWindowTimer; onGameTimeUpdate.Invoke(gameTimers); }
// added for the kiwi runner public void OpenInputWindow() { inputWindowTimer = 0.0f; inputWindow = InputWindowState.Open; setFabAlarmVariability(); onInputWindowChanged.Invoke(inputWindow); LogEvent("InputWindowChange"); inputWindowOpen = true; //Debug.Log("Input window opened"); }
private void Start() { this.resultsHistory = new List <bool[]>(); this.thresholdHistory = new List <float>(); this.isProcessed = false; this.result = new bool[] { }; this.thresholdRatio = this.inputThreshold / this.benchmarkInputThreshold; gm = GameObject.Find("GameManager").GetComponent <GameManager>(); lm = GameObject.Find("LoggingManager").GetComponent <LoggingManager>(); previousInputWindowState = InputWindowState.Closed; }
void Start() { inputWindow = InputWindowState.Closed; loggingManager = GameObject.Find("LoggingManager").GetComponent <LoggingManager>(); urn = gameObject.GetComponent <UrnModel>(); SetupMechanisms(); SetupUrn(); LogMeta(); cueAmount = cueAmount / interTrialIntervalSeconds; // Our code prepAmount = prepAmount / interTrialIntervalSeconds; // Our code interTrialAmount = interTrialAmount / interTrialIntervalSeconds; // Our code balloonColour = balloon.GetComponentInChildren <Renderer>().material; // Our code }
public void CloseInputWindow() { // update the window state. inputWindowOpen = false; //Debug.Log("Input window closed"); inputWindow = InputWindowState.Closed; inputWindowTimer = 0f; onInputWindowChanged.Invoke(inputWindow); LogEvent("InputWindowChange"); // store the input decision. actualInputOrder.Add(currentInputDecision); CalculateRecogRate(); // Send Decision Data GameDecisionData gameDecisionData = new GameDecisionData(); gameDecisionData.currentRecogRate = actualRecognitionRate; gameDecisionData.currentFabRate = actualRecognitionRate; gameDecisionData.currentFabAlarm = currentFabAlarm; gameDecisionData.decision = currentInputDecision; gameDecision.Invoke(gameDecisionData); LogEvent("GameDecision"); Debug.Log("designedInputOrder: " + designedInputOrder.Count); Debug.Log("actualInputOrder: " + actualInputOrder.Count); Debug.Log("Decision: " + System.Enum.GetName(typeof(InputTypes), currentInputDecision)); UpdateDesignedInputOrder(); int startPolicyReviewTrial = (int)Math.Floor((trials * startPolicyReview)); if (actualInputOrder.Count >= startPolicyReviewTrial) { //ReviewPolicy(); } // update Game Policy GamePolicyData gamePolData = new GamePolicyData(); gamePolData.gamePolicy = gamePolicy; onGamePolicyChanged.Invoke(gamePolData); }
public void ResetTrial() { inputWindowTimer = 0f; totalWindowTimer = 0.001f; inputWindow = InputWindowState.Closed; }
// Update is called once per frame void Update() { if (gameState == GameState.Running) { if (inputWindow == InputWindowState.Closed) { alarmFired = false; totalWindowTimer += Time.deltaTime; // Renamed interTrialTimer to totalWindowTimer if (totalWindowTimer < interTrialIntervalSeconds * interTrialAmount) // Our code { // Our code Debug.Log("Trial:" + currentTrial); switch (trialsTotal - currentTrial) { case 5: Fivetrial.Play(); break; case 15: FifteenTrial.Play(); break; default: break; } GameObject balloonChild = balloon.transform.GetChild(0).gameObject; balloonChild.SetActive(true); balloonColour.color = Color.white; // Our code } // Our code else if (totalWindowTimer < interTrialIntervalSeconds * (interTrialAmount + cueAmount)) // Our code { // Our code balloonColour.color = Color.red; // Our code } // Our code else { // Our code balloonColour.color = Color.yellow; // Our code } // Our code if (totalWindowTimer > interTrialIntervalSeconds && currentTrial < trialsTotal) { balloonColour.color = Color.green; // Our code totalWindowTimer = 0f; inputWindow = InputWindowState.Open; SetFabAlarmVariability(); onInputWindowChanged.Invoke(inputWindow); LogEvent("InputWindowChange"); } else if (currentTrial == trialsTotal) { Finish.Play(); EndGame(); } } else if (inputWindow == InputWindowState.Open) { //Debug.Log("inputwindow is open"); inputWindowTimer += Time.deltaTime; if (inputWindowTimer > currentFabAlarm && alarmFired == false) { //Debug.Log("inputWindowTimer exceeded currentFabAlarm."); // Fire fabricated input (if scheduled). InputData fabInputData = new InputData { validity = InputValidity.Accepted, type = InputType.FabInput, inputNumber = fabInputNumber }; MakeInputDecision(fabInputData, false); //balloonColour.color = Color.white; // Our code alarmFired = true; } else if (inputWindowTimer > inputWindowSeconds) { //Debug.Log("inputWindow expired."); // The input window expired MakeInputDecision(null, true); alarmFired = false; } } } GameTimers gameTimers = new GameTimers(); gameTimers.interTrialTimer = totalWindowTimer; gameTimers.inputWindowTimer = inputWindowTimer; onGameTimeUpdate.Invoke(gameTimers); }