Ejemplo n.º 1
0
        public void Setup(TrailInitData initData, Transform pointStart, Transform pointEnd, Material material)
        {
            PointStart  = pointStart;
            PointEnd    = pointEnd;
            MyMaterial  = material;
            Granularity = initData.Granularity;
            TrailLength = initData.TrailLength;
            Whitestep   = initData.Whitestep;

            _elemPool      = new ElementPool(TrailLength);
            _trailWidth    = (PointStart.position - PointEnd.position).magnitude;
            _vertexPool    = new VertexPool(MyMaterial, this);
            _vertexSegment = _vertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);
            UpdateIndices();

            _vertexPool.SetMeshObjectActive(false);

            _inited = true;
        }
        //you may pre-init the trail to save some performance.
        public void Init()
        {
            if (mInited)
            {
                return;
            }

            mElemPool = new ElementPool(MaxFrame);

            mTrailWidth = (PointStart.position - PointEnd.position).magnitude;

            InitMeshObj();

            InitOriginalElements();

            InitSpline();

            mInited = true;
        }
Ejemplo n.º 3
0
    public void StoresMaximumAmountOfPooledElements()
    {
        var pool = new ElementPool <Element>(5);

        for (int i = 0; i < 10; i++)
        {
            pool.ReturnElement(new Element());
        }

        var callCount = 0;

        for (int i = 0; i < 10; i++)
        {
            pool.GetOrCreateElement(() =>
            {
                callCount++;
                return(new Element());
            });
        }

        callCount.Should().Be(5);
    }
Ejemplo n.º 4
0
        public void Setup(TrailInitData initData, Transform pointStart, Transform pointEnd, Material material, bool editor)
        {
            PointStart  = pointStart;
            PointEnd    = pointEnd;
            Material    = material;
            Granularity = initData.Granularity;
            TrailLength = initData.TrailLength;
            Whitestep   = initData.Whitestep;

            gameObject.layer = 12;
            if (editor)
            {
                SortingOrder = 3;
            }

            _elemPool      = new ElementPool(TrailLength);
            _vertexPool    = new VertexPool(Material, this);
            _vertexSegment = _vertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);
            UpdateIndices();

            _vertexPool.SetMeshObjectActive(false);

            _inited = true;
        }
        //you may pre-init the trail to save some performance.
        public void Init()
        {
            if (mInited)
                return;

            mElemPool = new ElementPool(MaxFrame);

            mTrailWidth = (PointStart.position - PointEnd.position).magnitude;

            InitMeshObj();

            InitOriginalElements();

            InitSpline();

            mInited = true;
        }
Ejemplo n.º 6
0
 private OriginIconDescription([NotNull] string name, string authorFilter, string icon)
 {
     Name    = ContentUtils.Translate(name);
     Icon    = ContentUtils.GetIcon(icon ?? name + @".png", ContentCategory.OriginIcons, 16);
     _filter = Filter.Create(StringTester.Instance, authorFilter);
 }
Ejemplo n.º 7
0
 public void SetReferences(ElementPool pool)
 {
     this.pool = pool;
     SetReferences();
 }