Beispiel #1
0
        private void CreateTargetDataStructure(int index)
        {
            TargetGpu  target     = _targets[index];
            TargetInfo targetInfo = new TargetInfo
            {
                Position             = target.Position,
                AttractionRadiusSqrd = target.TargetAttractionRadiusSqrd,
                CoreRadiusSqrd       = target.TargetNotAffectingRadiusSqrd
            };

            _targetsData[index] = targetInfo;
            _targetsByInfo.Add(target, targetInfo);
        }
Beispiel #2
0
        private void UpdateTargetsPositions()
        {
            for (int i = 0; i < _targets.Count; i++)
            {
                TargetGpu  target     = _targets[i];
                TargetInfo targetInfo = _targetsByInfo[target];

                targetInfo.Position = target.transform.position;

                _targetsByInfo[target] = targetInfo;
            }

            int index = 0;

            foreach (TargetInfo targetInfo in _targetsByInfo.Values)
            {
                _targetsData[index] = targetInfo;
                index++;
            }

            _targetsBuffer.SetData(_targetsData);
        }