Beispiel #1
0
        private void CreateObstacleDataStructure(int index)
        {
            ObstacleGpu  obstacle     = _obstacles[index];
            ObstacleInfo obstacleInfo = new ObstacleInfo
            {
                Position   = obstacle.Position,
                RadiusSqrd = obstacle.ObstacleRadiusSqrd
            };

            _obstaclesData[index] = obstacleInfo;
            _obstaclesByInfo.Add(obstacle, obstacleInfo);
        }
Beispiel #2
0
        private void UpdateObstaclesPositions()
        {
            for (int i = 0; i < _obstacles.Count; i++)
            {
                ObstacleGpu  obstacle     = _obstacles[i];
                ObstacleInfo obstacleInfo = _obstaclesByInfo[obstacle];

                obstacleInfo.Position = obstacle.transform.position;

                _obstaclesByInfo[obstacle] = obstacleInfo;
            }

            int index = 0;

            foreach (ObstacleInfo obstacleInfo in _obstaclesByInfo.Values)
            {
                _obstaclesData[index] = obstacleInfo;
                index++;
            }

            _obstaclesBuffer.SetData(_obstaclesData);
        }