Пример #1
0
 public PathOnPlatform(PathTD p, PathSection pSec, PathSection prev, PathSection next)
 {
     path               = p;
     thisWP             = pSec;
     prevNeighbouringWP = prev;
     nextNeighbouringWP = next;
 }
Пример #2
0
        protected PathSection getPathSection(bool IsL2R, bool isTough = false)
        {
            InitParams    init        = new InitParams();
            ColoBox       box         = new ColoBox("", 1);
            Machine       machine     = new Machine(init, box);
            PathSection   pathSection = new PathSection(machine);
            DirectionBase direction   = null;

            if (IsL2R)
            {
                direction = new DirectionL2R(machine);
            }
            else
            {
                direction = new DirectionR2L(machine);
            }

            LayoutManager layoutManager = new LayoutManager(init);

            layoutManager.LocationMachine   = machine;
            machine.direction               = direction;
            machine.direction.LayoutManager = layoutManager;
            if (isTough)
            {
                machine.BorderVerifier = getToughBorderVerifier(direction, machine);
            }
            else
            {
                machine.BorderVerifier = getBorderVerifier(direction, machine);
            }

            return(pathSection);
        }
Пример #3
0
    public void SearchForNewPath(PathSection PS)
    {
        queue.Add(PS);

        /*Vector3 prevPoint;
         * if(prevNeighbouringWP.platform!=null){
         *      //place holder, platform to platform connection not supported yet
         *      prevPoint=prevNeighbouringWP.pos;
         * }
         * else prevPoint=prevNeighbouringWP.pos;
         * startN=PathFinder.GetNearestNode(prevPoint, nodeGraph);
         *
         * Vector3 nextPoint;
         * if(nextNeighbouringWP.platform!=null){
         *      //place holder, platform to platform connection not supported yet
         *      nextPoint=nextNeighbouringWP.pos;
         * }
         * else nextPoint=nextNeighbouringWP.pos;
         * endN=PathFinder.GetNearestNode(nextPoint, nodeGraph);*/


        foreach (PathOnPlatform path in pathObjects)
        {
            //Debug.Log("init path ................."+path.path);
            if (path.thisWP == PS)
            {
                path.InitNode(nodeGraph);

                PathFinderTD.GetPath(path.startN, path.endN, nodeGraph, this.SetPath);
            }
        }

        //PathFinder.GetPath(startN, endN, nodeGraph, this.SetPath);
    }
Пример #4
0
 public PathOnPlatform(PathTD p, PathSection pSec, PathSection prev, PathSection next)
 {
     path=p;
     thisWP=pSec;
     prevNeighbouringWP=prev;
     nextNeighbouringWP=next;
 }
Пример #5
0
    void Start()
    {
        //run through the list, generate a list of PathSection
        //if the element is a platform, generate the node and set it to walkable
        for (int i = 0; i < waypoints.Length; i++)
        {
            Transform wp = waypoints[i];

            //check if this is a platform, BuildManager would have add the component and have them layered
            if (waypoints[i] != null)
            {
                if (wp.gameObject.layer == LayerManager.LayerPlatform())
                {
                    //Debug.Log("platform");
                    PlatformTD platform = wp.gameObject.GetComponent <PlatformTD>();
                    path.Add(new PathSection(platform));
                }
                else
                {
                    path.Add(new PathSection(wp.position));
                }
            }
        }

        //scan through the path, setup the platform pathSection if there's any
        //first initiate all the basic parameter
        for (int i = 0; i < path.Count; i++)
        {
            PathSection pSec = path[i];
            if (path[i].platform != null)
            {
                //get previous and next pathSection
                PathSection sec1 = path[Mathf.Max(0, i - 1)];
                PathSection sec2 = path[Mathf.Min(path.Count - 1, i + 1)];

                //path[i].platform.SetNeighbouringWP(sec1, sec2);
                pSec.platform.SetPathObject(this, pSec, sec1, sec2);

                pSec.platform.SetWalkable(true);
                if (!pSec.platform.IsNodeGenerated())
                {
                    pSec.platform.GenerateNode(heightOffsetOnPlatform);
                }

                pSec.platform.SearchForNewPath(pSec);
            }
        }

        //now the basic have been setup,  setup the path
        //~ for(int i=0; i<path.Count; i++){
        //~ if(path[i].platform!=null){
        //~ path.platform.GetPath();
        //~ }
        //~ }

        if (generatePathObject)
        {
            StartCoroutine(CreateLinePath());
        }
    }
Пример #6
0
    //for complex mode, using path where waypoint may sometime be a field
    void MovePathMode()
    {
        //check if current PathSection is assigned
        if (currentPS == null)
        {
            //make sure we have a path
            if (path == null)
            {
                return;
            }

            List <PathSection> PSList = path.GetPath();
            if (wpCounter < PSList.Count)
            {
                currentPS = PSList[wpCounter];

                GetSubPath();
            }
            else
            {
                ReachFinalWayPoint();
            }
        }

        //execute as long as there are valid pathSection
        if (currentPS != null)
        {
            if (currentPathID != currentPS.GetPathID())
            {
                //~ Debug.Log("search  "+Time.time);
                SearchSubPath();
            }

            //move to the next waypoint, if return true, then update to the next waypoint
            if (MoveToPoint(subPath[subWPCounter]))
            {
                if (flying && subWPCounter == 0)
                {
                    subWPCounter = subPath.Count + 1;
                }
                else
                {
                    subWPCounter += 1;
                }

                //if the unit have reach the end of the subpath, update to next pathSection
                if (subWPCounter >= subPath.Count)
                {
                    wpCounter += 1;
                    currentPS  = null;
                }
            }
        }
    }
Пример #7
0
    //this is to resume a half completed path, called when the unit is a UnitCreep spawned by other UnitCreep
    public IEnumerator ResumeParentPath(bool wpM, List <Vector3> w, int wpC, PathSection cPS, List <Vector3> sP, int pID, int subWPC)
    {
        yield return(null);

        wpMode    = wpM;
        wpCounter = wpC;
        wp        = w;

        currentPS     = cPS;
        subPath       = sP;
        currentPathID = pID;
        subWPCounter  = subWPC;
    }
Пример #8
0
        public void LookAhead_BeginingL2RMeet2AngledLines()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -517.92;//-529.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            Assert.AreEqual(pathSection.UpperPathSections.Count, 1);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 1);
        }
Пример #9
0
    private void Reset(List <PathSection> PSList)
    {
        wpCounter    = 0;
        subWPCounter = 0;

        if (PSList != null && PSList.Count > 0)
        {
            currentPS = PSList[wpCounter];
        }
        GetSubPath();

        if (subPath != null && subPath.Count > 0)
        {
            indicatorT.position = subPath[subWPCounter];
        }
    }
Пример #10
0
        public void IsBoxOutside_inside_TouchR2L()
        {
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 410, Y = 335
            });
            PathSection pathSectionR2L = getPathSection(false, true);

            pathSectionR2L.SetRelativeLocation(box);

            //act
            bool isBoxR2LOutside = pathSectionR2L.machine.direction.IsBoxOutside(box, pathSectionR2L);

            //assert
            Assert.AreEqual(isBoxR2LOutside, false);
        }
Пример #11
0
        public void GetFirstBorderCoordinatExtremeR2L()
        {
            //arrange
            PathSection pathSectionR2L = getPathSection(false);
            ColoBox     box            = getBox(-9);

            box.MoveOriginTo(new Point {
                X = 153, Y = -28
            });
            pathSectionR2L.machine.CurrentBoxReference = box;

            //act
            double resultR2L = pathSectionR2L.machine.direction.GetFirstBorderCoordinate();

            //assert
            Assert.AreEqual(resultR2L, double.MinValue);
        }
Пример #12
0
        public void IsBoxOutside_Outside_CrazyColoR2L()
        {
            //arrange
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 692, Y = -395
            });
            PathSection pathSectionR2L = getPathSection(false);

            pathSectionR2L.SetRelativeLocation(box);

            //act
            bool isBoxR2LOutside = pathSectionR2L.machine.direction.IsBoxOutside(box, pathSectionR2L);

            //assert
            Assert.AreEqual(isBoxR2LOutside, true);
        }
Пример #13
0
        public void _1_UpdatemachineStateL2RBoxEndupOutside2()
        {
            //arrange
            PathSection pathSection         = getPathSection(true, true);
            ColoBox     currentBoxReference = getBox(0, true);

            currentBoxReference.MoveOriginTo(new Point {
                X = 456, Y = 459
            });
            pathSection.machine.CurrentBoxToPlace = currentBoxReference;

            //act
            Point?res = pathSection.UpdateMachineState(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.UpperPathSections[0].RelativeLocation.Value, RelativeLocation.Outside);
            Assert.AreEqual(pathSection.UpperPathSections[1].RelativeLocation.Value, RelativeLocation.Inside);
        }
Пример #14
0
        public void IsBoxOutside_Inside_CrazyColoL2R()
        {
            //arrange
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 655, Y = -375
            });
            PathSection pathSectionL2R = getPathSection(true);

            pathSectionL2R.SetRelativeLocation(box);

            //act
            bool isBoxL2ROutside = pathSectionL2R.machine.direction.IsBoxOutside(box, pathSectionL2R);

            //assert
            Assert.AreEqual(isBoxL2ROutside, false);
        }
Пример #15
0
        public void UpdateMachineStateL2RPath4()
        {
            //arrange
            PathSection pathSection         = getPathSection(true, true);
            double      maxY                = 563.92;//-529.92;
            ColoBox     currentBoxReference = getBox(maxY);

            currentBoxReference.MoveOriginTo(new Point {
                X = 464, Y = 335
            });
            pathSection.machine.CurrentBoxToPlace = currentBoxReference;

            //act
            Point?res = pathSection.UpdateMachineState(currentBoxReference);

            //assert
            Assert.AreEqual(res, null);
            Assert.AreEqual(pathSection.machine.IsInsideBoundingBox, false);
        }
Пример #16
0
        public void _2_IsBoxOutside_inside_TouchL2R()
        {
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 410, Y = 335
            });
            PathSection pathSectionL2R = getPathSection(true, true);

            pathSectionL2R.machine.CurrentBoxReference = box;
            pathSectionL2R.SetRelativeLocation(box);


            //act
            bool isBoxL2ROutside = pathSectionL2R.machine.direction.IsBoxOutside(box, pathSectionL2R);

            //assert
            Assert.AreEqual(isBoxL2ROutside, false);
        }
Пример #17
0
        public void UpdateMachineStateR2LPath2()
        {
            //arrange
            PathSection pathSection         = getPathSection(false, true);
            double      maxY                = 335;
            ColoBox     currentBoxReference = getBox(maxY, true);

            currentBoxReference.MoveOriginTo(new Point {
                X = 530, Y = maxY
            });
            pathSection.machine.CurrentBoxToPlace = currentBoxReference;

            //act
            Point?res = pathSection.UpdateMachineState(currentBoxReference);

            //assert
            Assert.AreEqual(res, null);
            Assert.AreEqual(pathSection.machine.IsInsideBoundingBox, false);
        }
Пример #18
0
        public void UpdateMachineStateL2RPath1()
        {
            //arrange
            PathSection pathSection         = getPathSection(true, true);
            double      maxY                = 335;
            ColoBox     currentBoxReference = getBox(maxY, true);

            currentBoxReference.MoveOriginTo(new Point {
                X = 490, Y = maxY
            });
            pathSection.machine.CurrentBoxToPlace = currentBoxReference;

            //act
            Point?res = pathSection.UpdateMachineState(currentBoxReference);

            //assert
            Assert.AreEqual(res.Value.X, 532);
            Assert.AreEqual(res.Value.Y, 335);
        }
Пример #19
0
        public void UpdatemachineStateR2LBoxEndupOutside()
        {
            //arrange
            PathSection pathSection         = getPathSection(false, true);
            double      maxY                = 415;
            ColoBox     currentBoxReference = getBox(maxY, true);

            currentBoxReference.MoveOriginTo(new Point {
                X = 456, Y = maxY
            });
            pathSection.machine.CurrentBoxToPlace = currentBoxReference;

            //act
            Point?res = pathSection.UpdateMachineState(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.LowerPathSections[0].RelativeLocation.Value, RelativeLocation.Outside);
            Assert.AreEqual(pathSection.LowerPathSections[1].RelativeLocation.Value, RelativeLocation.Inside);
            Assert.AreEqual(pathSection.LowerPathSections[2].RelativeLocation.Value, RelativeLocation.Outside);
        }
Пример #20
0
        public void GetNextLocation_Positive_R2L()
        {
            //arrange
            InitParams InitParam = new InitParams {
                ColdAisleWidth = 504
            };
            PathSection    pathSection = getPathSection(false);
            State_RowStart rowStart    = new State_RowStart(pathSection.machine);

            pathSection.machine.InitParam           = InitParam;
            pathSection.machine.RowNumber           = 1;
            pathSection.machine.CurrentBoxReference = getBox(-200);

            //act
            Point p = rowStart.GetNextLocation();


            Assert.AreEqual(Math.Round(p.X, 2), 677.8);
            Assert.AreEqual(Math.Round(p.Y, 2), -392);
        }
Пример #21
0
    bool GetNextWP()
    {
        List <PathSection> PSList = path.GetPath();

        if (wpCounter < PSList.Count)
        {
            currentPS = PSList[wpCounter];

            GetSubPath();

            return(true);
        }
        else
        {
            //reset all
            Reset(PSList);

            return(false);
        }
    }
Пример #22
0
        public void LookAhead_Top2SectionsPositiveNegative_NegativePositive()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -102.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.UpperPathSections.Count, 3);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 3);
            //upper
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].X, 2), 310.81);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].Y, 2), 342.65);
            Assert.AreEqual(pathSection.UpperPathSections[0].RelativeLocation, RelativeLocation.Inside);

            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[1].X, 2), 342.65);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[1].Y, 2), 400.61);
            Assert.AreEqual(pathSection.UpperPathSections[1].RelativeLocation, RelativeLocation.Outside);

            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[2].X, 2), 400.61);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[2].Y, 2), 474.96);
            Assert.AreEqual(pathSection.UpperPathSections[2].RelativeLocation, RelativeLocation.Inside);

            //lower
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].X, 2), 295.13);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].Y, 2), 358.33);
            Assert.AreEqual(pathSection.LowerPathSections[0].RelativeLocation, RelativeLocation.Inside);

            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[1].X, 2), 358.33);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[1].Y, 2), 390);
            Assert.AreEqual(pathSection.LowerPathSections[1].RelativeLocation, RelativeLocation.Outside);

            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[2].X, 2), 390);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[2].Y, 2), 487.91);
            Assert.AreEqual(pathSection.LowerPathSections[2].RelativeLocation, RelativeLocation.Inside);
        }
Пример #23
0
        public Machine(InitParams initParam, ColoBox boundingBox)
        {
            INSIDEBOUNDINGBOX  = new State_InsideBounding(this);
            OUTSIDEBOUNDINGBOX = new State_OutsideBounding(this);
            ROWSTARTS          = new State_RowStart(this);
            HITOBSTACLE        = new State_HitObstacle(this);

            currentState             = ROWSTARTS;
            RowNumber                = 0;
            this.InitParam           = initParam;
            this.InitParam.Tolerance = 0.5;
            this.boundingBox         = boundingBox;
            this.direction           = direction;
            IsSteppedOutBoundingBox  = false;
            //pathSectionBuilder = new PathSectionBuilder(this);
            PathSectionBuilder = new PathSection(this);

            LineOffsets = new Dictionary <int, double>();
            foreach (var offset in initParam.OffsetList)
            {
                LineOffsets.Add(offset.LineIndex, offset.Offset);
            }
        }
Пример #24
0
        public void LookAhead_2VerticalsAndNegative()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -381.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.UpperPathSections.Count, 1);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 1);
            //upper
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].X, 2), 300.5);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].Y, 2), 697);
            Assert.AreEqual(pathSection.UpperPathSections[0].RelativeLocation, RelativeLocation.Inside);

            //upper
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].X, 2), 297.61);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].Y, 2), 697);
            Assert.AreEqual(pathSection.LowerPathSections[0].RelativeLocation, RelativeLocation.Inside);
        }
Пример #25
0
 void Start()
 {
     nextSection = ScriptableObject.CreateInstance <BezierPath>();
 }
Пример #26
0
    //if this platform is part of a path, this function set the previous and next transform
    //public void SetNeighbouringWP(PathSection prev, PathSection next){
    //    prevNeighbouringWP=prev;
    //    nextNeighbouringWP=next;
    //}
    public void SetPathObject(PathTD p, PathSection pSec, PathSection prev, PathSection next)
    {
        PathOnPlatform path=new PathOnPlatform(p, pSec, prev, next);

        pathObjects.Add(path);
    }
Пример #27
0
    public void SearchForNewPath(PathSection PS)
    {
        queue.Add(PS);

        /*Vector3 prevPoint;
        if(prevNeighbouringWP.platform!=null){
            //place holder, platform to platform connection not supported yet
            prevPoint=prevNeighbouringWP.pos;
        }
        else prevPoint=prevNeighbouringWP.pos;
        startN=PathFinder.GetNearestNode(prevPoint, nodeGraph);

        Vector3 nextPoint;
        if(nextNeighbouringWP.platform!=null){
            //place holder, platform to platform connection not supported yet
            nextPoint=nextNeighbouringWP.pos;
        }
        else nextPoint=nextNeighbouringWP.pos;
        endN=PathFinder.GetNearestNode(nextPoint, nodeGraph);*/

        foreach(PathOnPlatform path in pathObjects){
            //Debug.Log("init path ................."+path.path);
            if(path.thisWP==PS) {
                path.InitNode(nodeGraph);

                PathFinder.GetPath(path.startN, path.endN, nodeGraph, this.SetPath);
            }
        }

        //PathFinder.GetPath(startN, endN, nodeGraph, this.SetPath);
    }
Пример #28
0
 public abstract bool IsBoxOutside(ColoBox boxToPlace, PathSection pathSection);
Пример #29
0
    bool GetNextWP()
    {
        List<PathSection> PSList=path.GetPath();

        if(wpCounter<PSList.Count){
            currentPS=PSList[wpCounter];

            GetSubPath();

            return true;
        }
        else{
            //reset all
            Reset(PSList);

            return false;
        }
    }
Пример #30
0
    //for complex mode, using path where waypoint may sometime be a field
    void MovePathMode()
    {
        //check if current PathSection is assigned
        if(currentPS==null){
            //make sure we have a path
            if(path==null) return;

            List<PathSection> PSList=path.GetPath();
            if(wpCounter<PSList.Count){
                currentPS=PSList[wpCounter];

                GetSubPath();
            }
            else ReachFinalWayPoint();
        }

        //execute as long as there are valid pathSection
        if(currentPS!=null){
            if(currentPathID!=currentPS.GetPathID()){
                SearchSubPath();
            }

            //move to the next waypoint, if return true, then update to the next waypoint
            if(MoveToPoint(subPath[subWPCounter])){
                if(flying && subWPCounter==0) subWPCounter=subPath.Count+1;
                else subWPCounter+=1;

                //if the unit have reach the end of the subpath, update to next pathSection
                if(subWPCounter>=subPath.Count){
                    wpCounter+=1;
                    currentPS=null;
                }
            }
        }
    }
Пример #31
0
    //this is to resume a half completed path, called when the unit is a UnitCreep spawned by other UnitCreep
    public IEnumerator ResumeParentPath(bool wpM, List<Vector3> w, int wpC, PathSection cPS, List<Vector3> sP, int pID, int subWPC)
    {
        yield return null;

        wpMode=wpM;
        wpCounter=wpC;
        wp=w;

        currentPS=cPS;
        subPath=sP;
        currentPathID=pID;
        subWPCounter=subWPC;
    }
Пример #32
0
    //init a unitCreep, give it a path instance so it can retirve the path
    public void Init(PathTD p, int uID, int wID)
    {
        base.Init();

        //reset waypoint
        SetWPCounter(0);
        currentPS=null;

        unitID=uID;
        waveID=wID;
        path=p;
        wpMode=false;

        if(flying) thisT.position+=new Vector3(0, flightHeightOffset, 0);

        if(!stopMoving) currentMoveSpd=moveSpeed;

        if(aniBody!=null && animationMove!=null && animationMove.Length>0){
            foreach(AnimationClip clip in animationMove){
                aniBody.animation[clip.name].speed=currentMoveSpd*moveAnimationModifier;
            }
        }

        //if using dynamic wap pos, set an offset based on gridsize
        if(path.dynamicWP>0){
            //float allowance=BuildManager.GetGridSize()*0.35f;
            float allowance=path.dynamicWP;
            dynamicOffset=new Vector3(Random.Range(-allowance, allowance), 0, Random.Range(-allowance, allowance));
            thisT.position+=dynamicOffset;
        }
        else dynamicOffset=Vector3.zero;

        if(spawnEffect!=null) ObjectPoolManager.Spawn(spawnEffect, thisT.position, Quaternion.identity);
        PlaySpawn();
        PlayMove();
    }
Пример #33
0
    //init a unitCreep, give it a list of Vector3 point as the path it should follow
    public void Init(List<Vector3> waypoints, int uID, int wID)
    {
        base.Init();

        //reset waypoint
        SetWPCounter(0);
        currentPS=null;

        unitID=uID;
        waveID=wID;
        wp=waypoints;
        wpMode=true;

        if(flying) thisT.position+=new Vector3(0, flightHeightOffset, 0);

        if(!stopMoving) currentMoveSpd=moveSpeed;

        if(aniBody!=null && animationMove!=null && animationMove.Length>0){
            foreach(AnimationClip clip in animationMove){
                aniBody.animation[clip.name].speed=currentMoveSpd*moveAnimationModifier;
            }
        }

        float allowance=BuildManager.GetGridSize();
        dynamicOffset=new Vector3(Random.Range(-allowance, allowance), 0, Random.Range(-allowance, allowance));
        thisT.position+=dynamicOffset;

        PlaySpawn();
        PlayMove();
    }
Пример #34
0
    private void Reset(List<PathSection> PSList)
    {
        wpCounter=0;
        subWPCounter=0;

        if(PSList!=null && PSList.Count>0) currentPS=PSList[wpCounter];
        GetSubPath();

        if(subPath!=null && subPath.Count>0) indicatorT.position=subPath[subWPCounter];
    }
Пример #35
0
    public void SetPathObject(PathTD p, PathSection pSec, PathSection prev, PathSection next)
    {
        PathOnPlatform path = new PathOnPlatform(p, pSec, prev, next);

        pathObjects.Add(path);
    }