Exemplo n.º 1
0
    public void Setup(TestCase myTestCase)
    {
        _testCase           = myTestCase;
        TargetPrefab        = (_testCase.TargetMode == TargetMode.Framed ? FramedTargetPrefab : FramelessTargetPrefab);
        _itemCounter        = _testCase.TargetsCount;
        _colorRangeCategory = 0;
        _spacingGroup       = 0;
        _range = _testCase.MinTargetScale > _testCase.MaxTargetScale ?
                 new Vector2Int(_testCase.MaxTargetScale, _testCase.MinTargetScale) :
                 new Vector2Int(_testCase.MinTargetScale, _testCase.MaxTargetScale);
        _config.SetCameraProperties(_testCase.DisplayMode);
        _colorMode = _testCase.Color;
        if (_colorMode == ColorMode.Space)
        {
            _colorRangeCategory = _config.ColorRanges.Count - 1;
        }

        if (_testCase.DistanceMode == DistanceMode.LinRegOptimised)
        {
            _spacingGroup = 2;
        }
        GameObject target = Instantiate(TargetPrefab);

        target.transform.parent = this.transform;
        float   size     = _config.GetRandomScale(_range);
        Vector2 position = new Vector2(0, 0);
        Color   color    = _config.GetColor(_colorMode, _colorRangeCategory);

        _targetData = new TargetData(color, position[0], position[1], size, DateTime.Now, _config.ColorDiffBg(color));
        target.GetComponent <TargetController>().Construct(size, position, color);
    }