private void OnTriggerEnter2D(Collider2D collision)
    {  //check collision with walls and trails.
        if (collision.gameObject.tag == "Trail" && Alive == true || collision.gameObject.tag == "Walls" && Alive == true)
        {
            TrailHandler handler = TrailManager.Instance.activeTrails[index].Handler;
            handler.Renderer.emitting = false;
            if (collision.gameObject.tag == "Trail")
            {
                TrailData tempdata = collision.gameObject.GetComponent <TrailCollision>().TrailData;
                if (tempdata.beforeSplitTrail == null)
                {
                    tempdata.TrailCollider.SplitPoint(transform, tempdata.Handler.transform);
                }
                else
                {
                    tempdata.TrailCollider.SubSplit(tempdata.beforeSplitTrail, transform);
                }

                collision.gameObject.SetActive(false);
            }
            else
            {
                handler.NewAtColl();
            }
            Death();
        }
    }
Beispiel #2
0
 public VisualData(TrailData trail_Data, ColorData color_Data, int display_Mode, bool applyTexture = false)
 {
     this.trailData   = trail_Data;
     this.colorData   = color_Data;
     this.displayMode = display_Mode;
     this.useTexture  = applyTexture;
 }
Beispiel #3
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            bool trail     = new bool();
            int  trailStep = new int();
            int  maxTrail  = new int();

            if (!DA.GetData(0, ref trail))
            {
                return;
            }
            if (!DA.GetData(1, ref trailStep))
            {
                return;
            }
            if (!DA.GetData(2, ref maxTrail))
            {
                return;
            }

            if (trailStep < 0)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Trail Step has to be greater than 0, please increase"); return;
            }
            if (maxTrail < 0)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "MaxTrail has to be greater than 0, please increase"); return;
            }

            TrailData trailData = new TrailData(trail, trailStep, maxTrail);

            DA.SetData(0, trailData);
        }
    public void NewTrailFromArr(Vector2[] newPositions, TrailData originalTrailOwnerData)
    {   //here we instantiate new edgecollider from the array.
        GameObject newTrail = Instantiate(collisionPrefab, GameManager.Instance.cleaner.transform.GetChild(0));

        newTrail.name = "SplitCollider";
        newTrail.GetComponent <EdgeCollider2D>().points = newPositions;
        TrailData tempdata = new TrailData(originalTrailOwnerData.Handler, newTrail.GetComponent <TrailCollision>(), originalTrailOwnerData.VisualTrail);

        tempdata.beforeSplitTrail = originalTrailOwnerData;
        newTrail.GetComponent <TrailCollision>().TrailData = tempdata;
    }
Beispiel #5
0
        public bool AddTrail(Trail trail, System.Windows.Forms.ProgressBar progressBar)
        {
            bool result = false;

            if (TrailData.InsertTrail(trail))
            {
                NewTrail(trail, true, progressBar);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Beispiel #6
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, TrailData trailData)
 {
     StripeConfiguration.SetApiKey(Configuration.GetSection("Stripe:SecretKey").Value);
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     else
     {
         app.UseExceptionHandler(BuilderExtensions =>
         {
             BuilderExtensions.Run(async context => {
                 context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                 var error = context.Features.Get <IExceptionHandlerFeature>();
                 if (error != null)
                 {
                     context.Response.AddApplicationError(error.Error.Message);
                     await context.Response.WriteAsync(error.Error.Message);
                 }
             });
         });
         // app.UseHsts();
     }
     // app.UseHttpsRedirection();
     trailData.TrailUsers();
     // .Allowcredentials()
     app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials());
     // app.UseCors (x => x.WithOrigins("http://localhost:4200").AllowAnyMethod().AllowAnyHeader());
     app.UseSignalR(routes => {
         routes.MapHub <ChatHub>("/chat");
     });
     app.UseAuthentication();
     app.UseDefaultFiles();
     app.Use(async(context, next) => {
         await next();
         if (context.Response.StatusCode == 404)
         {
             context.Request.Path = "/index.html";
             await next();
         }
     });
     app.UseStaticFiles();
     app.UseMvc();
 }
Beispiel #7
0
        private bool DeleteTrail(ActivityTrail at)
        {
            bool result = false;

            if (at != null)
            {
                //Only the primary trail deleted
                at.Init();
                if (TrailData.DeleteTrail(at.Trail))
                {
                    this.m_CurrentOrderedTrails.Remove(at);
                    this.m_currentActivityTrails.Remove(at);
                    this.m_prevSelectedTrails.Remove(at);
                    at     = null;
                    result = true;
                }
            }
            return(result);
        }
Beispiel #8
0
        public bool UpdateTrail(Trail trail, System.Windows.Forms.ProgressBar progressBar)
        {
            bool result = false;

            if (TrailData.UpdateTrail(trail))
            {
                foreach (ActivityTrail at in this.m_CurrentOrderedTrails)
                {
                    if (at.Trail.Id == trail.Id)
                    {
                        at.Trail = trail;
                        at.Init();
                        break;
                    }
                }
                this.SetCurrentActivityTrail(this.m_currentActivityTrails, true, progressBar);
                result = true;
            }
            return(result);
        }
Beispiel #9
0
    public void SubSplit(TrailData originalData, Transform playerPosition)
    {   //if trail was lrdy split, second split simply removes the collider and the visual presentation of that part of the trail.
        Vector2 vector2 = playerPosition.position;
        int     index   = FindBreakPoint(vector2, originalData.TrailCollider.collider2D);

        if (index > originalData.TrailCollider.collider2D.pointCount / 2)
        {   //finds the corresponding keypoint to delete to "remove" the visual part of the trail
            float SmallTime  = Mathf.Infinity;
            int   smallIndex = 999;
            for (int i = 0; i < 4; i++)
            {
                if (TrailData.VisualTrail.widthCurve[i].time < SmallTime)
                {
                    SmallTime  = TrailData.VisualTrail.widthCurve[i].time;
                    smallIndex = i;
                }
            }
            AnimationCurve temp = TrailData.VisualTrail.widthCurve;
            temp.RemoveKey(smallIndex);
            originalData.VisualTrail.widthCurve = temp;
        }
        else
        {
            //finds the corresponding keypoint to delete to "remove" the visual part of the trail
            float bigTime  = 0;
            int   bigIndex = 999;
            for (int i = 0; i < 4; i++)
            {
                if (TrailData.VisualTrail.widthCurve[i].time > bigTime)
                {
                    bigTime  = TrailData.VisualTrail.widthCurve[i].time;
                    bigIndex = i;
                }
            }
            AnimationCurve temp = TrailData.VisualTrail.widthCurve;
            temp.RemoveKey(bigIndex);
            originalData.VisualTrail.widthCurve = temp;
        }
        gameObject.SetActive(false);
    }
    public void NewTrail()
    {   //instanziates new trail and trail collider, setting colors and parents.
        if (GameManager.Instance.gameState == GameManager.GameState.running && player.Alive)
        {
            GameObject newTrail     = Instantiate(trailPrefab, transform);                                              //renderer
            GameObject newColliders = Instantiate(collisionPrefab, GameManager.Instance.cleaner.transform.GetChild(1)); //collider
            Renderer = newTrail.GetComponent <TrailRenderer>();
            TrailData data = new TrailData(this, newColliders.GetComponent <TrailCollision>(), Renderer);               //saving both to a referencepoint.
            TrailManager.Instance.activeTrails[gameObject.GetComponent <Player>().index] = data;
            trailData = data;
            data.TrailCollider.TrailData = data;


            Renderer.startColor          = _color;
            Renderer.endColor            = _color;
            data.TrailCollider.Expanding = true;
            Renderer.emitting            = true;

            Coroutine co  = StartCoroutine(UpdateTrail()); //start new trailCollider generation
            Coroutine co1 = StartCoroutine(TrailCut());    //And queues next cut.
        }
    }
Beispiel #11
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            if (GH_Document.IsEscapeKeyDown())
            {
                GH_Document GHDocument = OnPingDocument();
                GHDocument.RequestAbortSolution();
                return;
            }

            ikvm.runtime.Startup.addBootClassPathAssemby(Assembly.Load("culebra"));
            ikvm.runtime.Startup.addBootClassPathAssemby(Assembly.Load("IKVM.OpenJDK.Core"));

            bool           reset           = new bool();
            int            iterations      = new int();
            List <object>  init_Settings   = new List <object>();
            List <object>  move_Settings   = new List <object>();
            IGH_VisualData visual_Settings = null;

            object behavioral_Settings = null;

            if (!DA.GetDataList(0, init_Settings) || init_Settings.Count == 0 || init_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No Init Settings Detected, please connect Init Settings to enable the component");
                return;
            }
            if (!DA.GetDataList(1, move_Settings) || move_Settings.Count == 0 || move_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No Move Settings Detected, please connect Move Settings to enable the component");
                return;
            }
            if (!DA.GetData(3, ref visual_Settings) || visual_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No Visual Settings Detected, please connect Visual Settings to enable the component");
                return;
            }
            if (!DA.GetData(4, ref iterations))
            {
                return;
            }
            if (!DA.GetData(5, ref reset))
            {
                return;
            }
            Random rnd = new Random();

            if (!DA.GetData(2, ref behavioral_Settings) || behavioral_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Input Object is Null");
                return;
            }
            string objtype = behavioral_Settings.GetType().Name.ToString();

            if (!(behavioral_Settings.GetType() == typeof(IGH_BehaviorData)))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "You did not input a Behavior Data Object, please ensure input is Behavior Data Object and not " + objtype);
                return;
            }
            else
            {
                #region Initialize / Data Parse
                //------------------------Init Settings--------------------------
                if (init_Settings.Count != 0)
                {
                    String init_Convert = "";
                    if (init_Settings[0].GetType() == typeof(GH_String))
                    {
                        GH_String value = (GH_String)init_Settings[0];
                        init_Convert = value.Value;
                    }
                    if (init_Convert == "Box")
                    {
                        this.spawnData = "box";
                        GH_Convert.ToBox_Primary(init_Settings[3], ref this.box);
                        GH_Convert.ToInt32(init_Settings[4], out this.spawnType, GH_Conversion.Primary);
                        GH_Convert.ToInt32(init_Settings[5], out this.pointCount, GH_Conversion.Primary);
                        GH_Convert.ToInt32(init_Settings[1], out this.dimensions, GH_Conversion.Primary);
                    }
                    else if (init_Convert == "Points")
                    {
                        this.spawnData = "Points";
                        var wrapperToGoo = GH_Convert.ToGoo(init_Settings[3]);
                        wrapperToGoo.CastTo <List <Point3d> >(out this.ptList);
                        GH_Convert.ToInt32(init_Settings[1], out this.dimensions, GH_Conversion.Primary);
                        GH_Convert.ToBox_Primary(init_Settings[4], ref this.box);
                    }
                    GH_Convert.ToInt32(init_Settings[2], out this.bounds, GH_Conversion.Primary);
                }
                //------------------------Move Settings--------------------------
                Vector3d initialVector = new Vector3d();
                if (move_Settings.Count != 0)
                {
                    if (move_Settings[0].GetType() == typeof(GH_Vector))
                    {
                        GH_Vector value = (GH_Vector)move_Settings[0];
                        initialVector = value.Value;
                    }
                    else if (move_Settings[0].GetType() == typeof(GH_Number))
                    {
                        GH_Number value = (GH_Number)move_Settings[0];
                        this.initialSpeed = value.Value;
                    }
                    GH_Convert.ToDouble(move_Settings[1], out this.maxSpeed, GH_Conversion.Primary);
                    GH_Convert.ToDouble(move_Settings[2], out this.maxForce, GH_Conversion.Primary);
                    GH_Convert.ToDouble(move_Settings[3], out this.velMultiplier, GH_Conversion.Primary);
                }
                //------------------------Visual Settings--------------------------
                TrailData td = visual_Settings.Value.trailData;
                ColorData cd = visual_Settings.Value.colorData;
                this.trail           = td.createTrail;
                this.displayMode     = visual_Settings.Value.displayMode;
                this.trailStep       = td.trailStep;
                this.maxTrailSize    = td.maxTrailSize;
                this.particleTexture = cd.particleTexture;
                this.graphicType     = cd.colorDataType;
                this.useTexture      = visual_Settings.Value.useTexture;
                if (cd.colorDataType == "Gradient")
                {
                    this.maxthick       = cd.maxThickness;
                    this.minthick       = cd.minThickness;
                    this.redValues[0]   = cd.redChannel[0];
                    this.redValues[1]   = cd.redChannel[1];
                    this.greenValues[0] = cd.greenChannel[0];
                    this.greenValues[1] = cd.greenChannel[1];
                    this.blueValues[0]  = cd.blueChannel[0];
                    this.blueValues[1]  = cd.blueChannel[1];
                }
                else if (cd.colorDataType == "GraphicPolyline")
                {
                    this.polylineColor = cd.color;
                    this.dotted        = cd.dotted;
                    this.maxthick      = cd.maxThickness;
                }
                else if (cd.colorDataType == "Disco")
                {
                    this.maxthick = cd.maxThickness;
                    this.minthick = cd.minThickness;
                }
                else if (cd.colorDataType == "Base")
                {
                    this.maxthick = 3;
                    this.minthick = 1;
                }
                //-----------------------------------------------------------------
                IGH_PreviewObject comp = (IGH_PreviewObject)this;
                if (comp.Hidden && (this.displayMode == 0))
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Component preview must be enabled to see Graphic Mode on Canvas, right click on component and set preview on");
                }
                #endregion
                #region Pre Simulation Code
                //------------------------RESET STARTS HERE--------------------------
                if (reset)
                { //We are using the reset to reinitialize all the variables and positions
                    //-----------------------------------------------------------------
                    this.bb = new BoundingBox();
                    int  loopCount = new int();
                    bool create    = new bool();
                    if (this.spawnData == "box")
                    {
                        this.bb   = this.box.BoundingBox;
                        loopCount = this.pointCount;
                        create    = true;
                    }
                    else if (this.spawnData == "Points")
                    {
                        loopCount = this.ptList.Count;
                        create    = false;
                        this.bb   = this.box.BoundingBox;
                    }
                    //-----------------------------------------------------------------
                    this.moveList       = new List <Vector3d>();
                    this.startList      = new List <Vector3d>();
                    this.creepList      = new List <CulebraObject>();
                    this.currentPosList = new List <Point3d>();
                    this.networkList    = new List <Line>();
                    flattenedTrails     = new List <Vector3d>();

                    for (int i = 0; i < loopCount; i++)
                    {
                        if (this.dimensions == 0)
                        { //If we want 2D
                            General.setViewport("Top", "Shaded");
                            if (create)
                            { //If are creating random points inside bbox
                                if (this.spawnType == 0 || this.spawnType == 2)
                                {
                                    this.startPos = new Vector3d((int)bb.Min[0], rnd.Next((int)bb.Min[1], (int)bb.Max[1]), 0); //spawn along the y axis of the bounding area
                                }
                                else if (this.spawnType == 1 || this.spawnType == 3)
                                {
                                    this.startPos = new Vector3d(rnd.Next((int)bb.Min[0], (int)bb.Max[0]), rnd.Next((int)bb.Min[1], (int)bb.Max[1]), 0); //spawn randomly inside the bounding area
                                }
                                if (initialVector.Length > 0)
                                {
                                    this.moveVec = initialVector; //move in the user specified direction
                                }
                                else
                                {
                                    this.moveVec = new Vector3d(rnd.Next(-1, 2) * initialSpeed, rnd.Next(-1, 2) * initialSpeed, 0); //move randomly in any direction 2d
                                }
                            }
                            else
                            { //If we are using user defined points
                                this.startPos = (Vector3d)this.ptList[i];
                                if (initialVector.Length > 0)
                                {
                                    this.moveVec = initialVector; //move in the user specified direction
                                }
                                else
                                {
                                    this.moveVec = new Vector3d(rnd.Next(-1, 2) * initialSpeed, rnd.Next(-1, 2) * initialSpeed, 0); //move randomly in any direction 2d
                                }
                            }
                            this.creep = new Creeper(this.startPos, this.moveVec, true, false);
                            this.creepList.Add(this.creep);
                        }
                        else
                        { //If we want 3D
                            General.setViewport("Perspective", "Shaded");
                            if (create)
                            { //If are creating random points inside bbox
                                if (this.spawnType == 0 || this.spawnType == 2)
                                {
                                    this.startPos = new Vector3d(rnd.Next((int)bb.Min[0], (int)bb.Max[0]), rnd.Next((int)bb.Min[1], (int)bb.Max[1]), (int)bb.Min[2]); //start randomly on the lowest plane of the 3d bounds
                                    if (initialVector.Length > 0)
                                    {
                                        this.moveVec = initialVector; //move in the user specified direction
                                    }
                                    else
                                    {
                                        this.moveVec = new Vector3d(rnd.Next(-2, 2) * initialSpeed, rnd.Next(-2, 2) * initialSpeed, 1 * initialSpeed); //move randomly in the xy axis and up in the z axis
                                    }
                                }
                                else if (this.spawnType == 1 || this.spawnType == 3)
                                {
                                    this.startPos = new Vector3d(rnd.Next((int)bb.Min[0], (int)bb.Max[0]), rnd.Next((int)bb.Min[1], (int)bb.Max[1]), rnd.Next((int)bb.Min[2], (int)bb.Max[2])); //start randomly inside the 3d bounds
                                    if (initialVector.Length > 0)
                                    {
                                        this.moveVec = initialVector; //move in the user specified direction
                                    }
                                    else
                                    {
                                        this.moveVec = new Vector3d(rnd.Next(-2, 2) * initialSpeed, rnd.Next(-2, 2) * initialSpeed, rnd.Next(-2, 2) * initialSpeed); //move randomly in any direction 3d
                                    }
                                }
                            }
                            else
                            { //If we are using user defined points
                                this.startPos = (Vector3d)this.ptList[i];
                                if (initialVector.Length > 0)
                                {
                                    this.moveVec = initialVector; //move in the user specified direction
                                }
                                else
                                {
                                    this.moveVec = new Vector3d(rnd.Next(-2, 2) * initialSpeed, rnd.Next(-2, 2) * initialSpeed, rnd.Next(-2, 2) * initialSpeed); //move randomly in any direction 3d
                                }
                            }
                            this.creep = new Creeper(this.startPos, this.moveVec, true, true);
                            this.creepList.Add(this.creep);
                        }
                        this.startList.Add(this.startPos); //add the initial starting positions to the list to pass once we start running
                        this.moveList.Add(this.moveVec);   //add the initial move vectors to the list to pass once we start running
                    }
                    #endregion
                    #region Simulation Code
                    this.trailTree    = new DataTree <Point3d>();
                    this.globalEngine = new Engine_Global();
                    for (int z = 0; z < iterations; z++)
                    {
                        this.particleSet    = new DataTree <Point3d>();
                        this.currentPosList = new List <Point3d>();

                        this.trailTree.Clear();
                        this.networkTree.Clear();
                        this.trailTree.TrimExcess();
                        this.networkTree.TrimExcess();

                        if (this.moveList == null)
                        {
                            AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Please Reset the CreepyCrawlers Component"); return;
                        }
                        try
                        {
                            globalEngine.Action(this.creepList, this.dimensions, behavioral_Settings, this.displayMode, this.networkList,
                                                this.maxSpeed, this.maxForce, this.velMultiplier, this.flattenedTrails, this.particleList, this.particleSet, networkTree, trailStep, maxTrailSize, bounds, bb, currentPosList, trail, trailTree);
                        }
                        catch (Exception e)
                        {
                            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message.ToString());
                            return;
                        }

                        this.flattenedTrails.Clear();
                        this.flattenedTrails.TrimExcess();

                        #endregion
                    }
                    DA.SetDataList(0, this.currentPosList);
                    DA.SetDataTree(2, networkTree);
                    if (this.displayMode == 1 && this.trail)
                    {
                        DA.SetDataTree(1, trailTree);
                    }
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            object       behavioral_Settings = null;
            object       visual_Settings     = null;
            bool         reset  = new bool();
            List <Curve> curves = new List <Curve>();

            if (!DA.GetDataList(0, curves))
            {
                return;
            }
            if (!DA.GetData(1, ref behavioral_Settings) || behavioral_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Behavior Input Object is Null");
                return;
            }
            string objtype = behavioral_Settings.GetType().Name.ToString();

            if (!(behavioral_Settings.GetType() == typeof(IGH_BehaviorData)))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "You did not input a Behavior Data Object, please ensure input is Behavior Data Object and not " + objtype);
                return;
            }
            if (!DA.GetData(2, ref visual_Settings) || visual_Settings == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Visual Input Object is Null");
                return;
            }
            string objtype2 = visual_Settings.GetType().Name.ToString();

            if (!(visual_Settings.GetType() == typeof(IGH_VisualData)))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "You did not input a Visual Data Object, please ensure input is Visual Data Object and not " + objtype2);
                return;
            }
            if (!DA.GetData(3, ref reset))
            {
                return;
            }
            //------------------------Visual Settings--------------------------
            IGH_VisualData igh_Visual = (IGH_VisualData)visual_Settings;
            TrailData      td         = igh_Visual.Value.trailData;
            ColorData      cd         = igh_Visual.Value.colorData;

            this.trail           = td.createTrail;
            this.displayMode     = igh_Visual.Value.displayMode;
            this.trailStep       = td.trailStep;
            this.maxTrailSize    = td.maxTrailSize;
            this.particleTexture = cd.particleTexture;
            this.graphicType     = cd.colorDataType;
            this.useTexture      = igh_Visual.Value.useTexture;
            if (cd.colorDataType == "Gradient")
            {
                this.maxthick       = cd.maxThickness;
                this.minthick       = cd.minThickness;
                this.redValues[0]   = cd.redChannel[0];
                this.redValues[1]   = cd.redChannel[1];
                this.greenValues[0] = cd.greenChannel[0];
                this.greenValues[1] = cd.greenChannel[1];
                this.blueValues[0]  = cd.blueChannel[0];
                this.blueValues[1]  = cd.blueChannel[1];
            }
            else if (cd.colorDataType == "GraphicPolyline")
            {
                this.polylineColor = cd.color;
                this.dotted        = cd.dotted;
                this.maxthick      = cd.maxThickness;
            }
            else if (cd.colorDataType == "Disco")
            {
                this.maxthick = cd.maxThickness;
                this.minthick = cd.minThickness;
            }
            else if (cd.colorDataType == "Base")
            {
                this.maxthick = 3;
                this.minthick = 1;
            }
            //-----------------------------------------------------------------
            if (reset)
            {
                this.cycles  = 0;
                this.crvList = new List <Curve>();
                this.crvList = curves;
                DA.SetDataList(0, crvList);
            }
            else
            {
                this.particleSet.Clear();
                this.particleSet.TrimExcess();

                IGH_BehaviorData igh_Behavior = (IGH_BehaviorData)behavioral_Settings;

                this.thresh    = igh_Behavior.Value.bundlingData.threshold;
                this.ratio     = igh_Behavior.Value.bundlingData.ratio;
                this.ptCount   = igh_Behavior.Value.bundlingData.pointCount;
                this.rebuild   = igh_Behavior.Value.bundlingData.rebuild;
                this.weldCount = igh_Behavior.Value.bundlingData.weldCount;
                //-----------------------------------------------------------------
                foreach (string s in igh_Behavior.Value.dataOrder)
                {
                    if (s == "Bundling")
                    {
                        try
                        {
                            if (igh_Behavior.Value.bundlingData.colorMesh != null)
                            {
                                this.crvList = this.selfOrg.Bundling(particleList, particleSet, this.crvList, this.thresh, this.ratio, this.weldCount, this.rebuild, this.ptCount,
                                                                     igh_Behavior.Value.bundlingData.colorMesh, igh_Behavior.Value.bundlingData.useColor);
                            }
                            else
                            {
                                this.crvList = this.selfOrg.Bundling(particleList, particleSet, this.crvList, this.thresh, this.ratio, this.weldCount, this.rebuild, this.ptCount);
                            }
                        }
                        catch (Exception e)
                        {
                            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message.ToString());
                            return;
                        }
                    }
                    else
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Currently we can only run bundling behavior on the Bundling Engine, please remove other behaviors");
                        return;
                    }
                }
                if (this.displayMode == 1)
                {
                    DA.SetDataList(0, this.crvList);
                }
                this.cycles++;
            }
            timer.DisplayMessage(this, "Bundling", this.cycles, this.myBool);
        }