Ejemplo n.º 1
0
 /// <summary>
 /// Sets the ObjectPreview to display the tracked object for the trial.
 /// </summary>
 /// <param name="settings">The tracked object's settings.</param>
 public void SetUI(BasicTrialManager.BouncingObjectSettings settings)
 {
     Preview.SetImage(BouncingObject.GetObjectSprite(settings.Shape), settings.Color.GetColor());
     StartButton.interactable = false;
     ActivationTimer          = 0;
     gameObject.SetActive(true);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Starts the trial. Spawns all the BouncingObjects, and starts Co-routine to
    /// spawn the UnusualObjects on the correct timer.
    /// </summary>
    public void BeginTrial()
    {
        State      = TrialState.Trial;
        TrialTimer = 0;
        BouncingObject.ResetBounces();

        //Spawns BouncingObjects
        foreach (BouncingObjectSettings settings in Settings.BouncingObjects)
        {
            for (int i = 0; i < settings.NumberToSpawn; i++)
            {
                BouncingObject bouncingObject = GameObject.Instantiate <BouncingObject> (BouncingObjectPrefab);
                bouncingObject.SetObjectSettings(settings, Camera);
                BouncingObjects.Add(bouncingObject);
            }
        }

        //Starts Co-routine to spawn UnusualObject if this trial is an unusual one.
        if (UnusualTrials [TrialIteration])
        {
            foreach (UnusualObjectSettings settings in Settings.UnusualObjects)
            {
                StartCoroutine(SpawnUnusualObject(settings));
            }
        }
    }
    /// <summary>
    /// Initializes the UI, updating the ObjectPreview to have the passed in
    /// sprite displayed in the passed in color.
    /// </summary>
    /// <param name="objectSprite">The sprite to display.</param>
    /// <param name="objectColor">The color of the sprite.</param>
    public void InitializeUI(BasicTrialManager trialManager, BasicTrialManager.BouncingObjectSettings [] objectSettings)
    {
        TrialManager = trialManager;
        foreach (BasicTrialManager.BouncingObjectSettings settings in objectSettings)
        {
            ObjectPreview preview = GameObject.Instantiate <ObjectPreview> (ObjectPreviewPrefab);
            preview.SetImage(BouncingObject.GetObjectSprite(settings.Shape), settings.Color.GetColor());
            preview.GetComponent <RectTransform> ().SetParent(ObjectPreviewLayout.transform, false);
        }

        StartButton.interactable = false;
        StartTimer = 0;
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Starts another iteration of the trial on successful completion of the Questionnaire.
    /// TODO: Update with stat collection!!
    /// </summary>
    public override void QuestionniareFinished()
    {
        BasicTrialResults result = new BasicTrialResults
        {
            TrialNumber          = TrialIteration,
            ConditionNumber      = Settings.ConditionNumber,
            IsUnusualTrial       = UnusualTrials [TrialIteration],
            NumberOfBounces      = BouncingObject.GetNumberOfBounces(),
            QuestionnaireAnswers = Questionnaire.GetAnswers(),
            UnusualObjectShape   = Settings.UnusualObjects [0].Shape
        };

        Results.Add(result);
        TrialIteration++;
        if (TrialIteration < Settings.NumberOfTrials)
        {
            ShowPreTrialUI();
        }
        else
        {
            TrialsFinished();
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the image of the object's preview.
 /// </summary>
 public void SetPreviewImage()
 {
     ObjectPreview.sprite = BouncingObject.GetObjectSprite((BouncingObject.ObjectShapes)Shape.value);
 }