示例#1
0
        protected override void PreMethod()
        {
            //Get reference to custom ExperimentRunner
            TutorialSampleExperimentRunner tutorialRunner = (TutorialSampleExperimentRunner)Runner;

            //Get value of distance for this block.
            float distance = (float)Data["Distance"];

            //get position
            Vector3 position = tutorialRunner.Stimulus.transform.localPosition;

            //set z of position to the distance value.
            position.z = distance;

            //update stimulus position to new position
            tutorialRunner.Stimulus.transform.localPosition = position;
        }
示例#2
0
        protected override void PreMethod()
        {
            // convert the generic ExperimentRunner to your custom type of ExperimentRunner.
            tutorialRunner = (TutorialSampleExperimentRunner)Runner;

            //Get this trial's value for the Color variable
            string colorString = (string)Data["Color"];

            //Set the material of the stimulus to the color
            MeshRenderer stimulusMesh = tutorialRunner.Stimulus.GetComponent <MeshRenderer>();

            switch (colorString)
            {
            case "Red":
                stimulusMesh.material = tutorialRunner.Red;
                break;

            case "Blue":
                stimulusMesh.material = tutorialRunner.Blue;
                break;

            case "Green":
                stimulusMesh.material = tutorialRunner.Green;
                break;

            default:
                throw new ArgumentOutOfRangeException($"No material defined for {colorString}");
            }

            //Get this trial's value for the Size variable
            float size = (float)Data["Size"];

            //Set the size of Model
            Transform modelTransform = tutorialRunner.Model.transform;

            modelTransform.localScale = new Vector3(size, size, size);
        }