Exemplo n.º 1
0
    public void Respawn(DateTime now)
    {
        if (_itemCounter <= 0)
        {
            if (_spacingGroup == 0)
            {
                if (_colorRangeCategory == 0)
                {
                    _targetData.DestroyTime = now;
                    SendMessageUpwards("TargetAcquired", _targetData);
                    SendMessageUpwards("TestCompleted");
                    return;
                }
                _itemCounter = _testCase.TargetsCount;
                _colorRangeCategory--;
                if (_testCase.DistanceMode == DistanceMode.LinRegOptimised)
                {
                    _spacingGroup = 2;
                }
            }
            else
            {
                _itemCounter = _testCase.TargetsCount;
                _spacingGroup--;
            }
        }
        _targetData.DestroyTime = now;
        SendMessageUpwards("TargetAcquired", _targetData);
        GameObject target = Instantiate(TargetPrefab);

        target.transform.parent = this.transform;
        Tuple <Vector2, float> targetLocalization = _config.GetRandomPosition(_testCase.DistanceMode, _testCase.Radius, _targetData,
                                                                              _spacingGroup, _range);
        float   size     = targetLocalization.Item2;
        Vector2 position = targetLocalization.Item1;
        Color   color    = _config.GetColor(_colorMode, _colorRangeCategory);

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