示例#1
0
        private void EnsureCapacity(int capacity, Unity.Collections.Allocator allocator)
        {
            Debug.Assert(capacity > 0);

            if (positions != null && positions.Length > capacity)
            {
                return;
            }

            if (positions != null)
            {
                Dispose();
            }

            positions              = new NativeArray <float3>(capacity, allocator);
            rotations              = new NativeArray <quaternion>(capacity, allocator);
            scales                 = new NativeArray <float>(capacity, allocator);
            leashes                = new NativeArray <float2>(capacity, allocator);
            followStates           = new NativeArray <SplineMath.SplineGraphFollowState>(capacity, allocator);
            randoms                = new NativeArray <Unity.Mathematics.Random>(capacity, allocator);
            velocities             = new NativeArray <float>(capacity, allocator);
            ages                   = new NativeArray <float>(capacity, allocator);
            lifetimes              = new NativeArray <float>(capacity, allocator);
            facingReverseIsEnabled = new NativeArray <bool>(capacity, allocator);
        }
        private void EnsureCapacity(int capacity, Unity.Collections.Allocator allocator)
        {
            Debug.Assert(capacity > 0);

            if (bounds != null && bounds.Length > capacity)
            {
                return;
            }

            if (bounds != null)
            {
                Dispose();
            }

            bounds      = new NativeArray <VolumeFalloff.OrientedBBox>(capacity, allocator);
            falloffData = new NativeArray <VolumeFalloff.VolumeFalloffEngineData>(capacity, allocator);
            audioData   = new NativeArray <AmbientAudioVolume.AmbientAudioVolumeEngineData>(capacity, allocator);
        }
        private void EnsureCapacityAudioVolume(int capacity, Unity.Collections.Allocator allocator)
        {
            Debug.Assert(capacity > 0);

            if (audioVolume != null && audioVolume.Length > capacity)
            {
                return;
            }

            // Need to preserve any prexisting values, so that we don't cut out / restart audio on reallocs.
            AudioPoolElement[] audioPoolElementsNext = new AudioPoolElement[capacity];
            if (audioVolume != null)
            {
                for (int i = 0; i < audioVolumeCount; ++i)
                {
                    audioPoolElementsNext[i] = audioPoolElements[i];
                }

                DisposeAudioVolume();
            }

            audioVolume       = new NativeArray <float2>(capacity, allocator);
            audioPoolElements = audioPoolElementsNext;
        }