Exemplo n.º 1
0
 public void AddPoly(List <List <IntPoint> > polys, CompEntityPoly adderComp)
 {
     ApPairs.Add(new APPair()
     {
         AdderComp = adderComp, Poly = polys
     });
 }
Exemplo n.º 2
0
 public void AddPoly(List <IntPoint> poly, CompEntityPoly adderComp)
 {
     ApPairs.Add(new APPair()
     {
         AdderComp = adderComp, Poly = new List <List <IntPoint> >()
         {
             poly
         }
     });
 }
Exemplo n.º 3
0
        public List <BumperEntityPoly> GetReachableBumpers(List <List <IntPoint> > spaceSoFar,
                                                           CompEntityPoly adder)
        {
            var rCompsAllNew = _entraAgentSimple.AreaCompPolyHandler.GetReachServicePolys(spaceSoFar, new List <CompEntityPoly>()
            {
                adder
            });
            var rBumpers = rCompsAllNew.Where(comp => comp is BumperEntityPoly).Cast <BumperEntityPoly>().ToList();

            return(rBumpers);
        }
Exemplo n.º 4
0
        public static CookieDirection GetABCookieDirection(CompEntityPoly entity, BumperEntityPoly bumper)
        {
            var refPos  = entity.PositionXNACenter2D;
            var bumpPos = bumper.PositionXNACenter2D;

            if (refPos.Y < bumpPos.Y)
            {
                return(CookieDirection.FromAbove);
            }
            else
            {
                return(CookieDirection.FromBottom);
            }
        }
Exemplo n.º 5
0
        public static List <List <IntPoint> > GetCompCoverageSoFar(CompEntityPoly me, List <PolyLog> polys)
        {
            List <List <IntPoint> > polysMe = new List <List <IntPoint> >();

            foreach (PolyLog polyLog in polys)
            {
                if (polyLog.Comp == me)
                {
                    foreach (APPair apPair in polyLog.ApPairs)
                    {
                        polysMe.AddRange(apPair.Poly);
                    }
                }
            }
            polysMe = EntraSolver.GetPolyUnions(polysMe);
            return(polysMe);
        }
Exemplo n.º 6
0
        public static List <BumperEntityPoly> GetCoveredBumpers(CompEntityPoly entity, List <List <IntPoint> > initialPoly)
        {
            List <BumperEntityPoly> coveredBumps = new List <BumperEntityPoly>();
            List <BumperEntityPoly> rBumpers     = entity.EntraAgentSimple.BumpersHandler.GetReachableBumpers(initialPoly,
                                                                                                              entity.EntraAgentSimple
                                                                                                              .AllCompsEntities);

            foreach (BumperEntityPoly bumper in rBumpers)
            {
                if (EntraSolver.IsPolyOperation(initialPoly, bumper.GetDefPoly(),
                                                ClipType.ctIntersection))
                {
                    coveredBumps.Add(bumper);
                }
            }
            return(coveredBumps);
        }
Exemplo n.º 7
0
        private bool IsOkToProcess(CompEntityPoly lastAdder, CompEntityPoly newCovered)
        {
            if (!_processedComps.Keys.Contains(lastAdder))
            {
                _processedComps.Add(lastAdder, new List <CompEntityPoly>()
                {
                    newCovered
                });
                return(true);
            }

            if (!_processedComps[lastAdder].Contains(newCovered))
            {
                _processedComps[lastAdder].Add(newCovered);
                return(true);
            }
            return(false);
        }
Exemplo n.º 8
0
        public static int BumpersComparator(CompEntityPoly e1, CompEntityPoly e2)
        {
            BumpRigid b1 = e1.CompObj as BumpRigid;
            BumpRigid b2 = e2.CompObj as BumpRigid;

            if (b1.PositionXNACenter2D.Y > b2.PositionXNACenter2D.Y)
            {
                return(1);
            }
            else
            {
                if (b1.PositionXNACenter2D.Y < b2.PositionXNACenter2D.Y)
                {
                    return(-1);
                }
            }
            return(0);
        }
 private void AddUsage(CompEntityPoly comp)
 {
     if (comp is RocketEntityPoly)
     {
         UsedRockets++;
     }
     if (comp is RopeEntityPoly)
     {
         UsedRopes++;
     }
     if (comp is BlowerEntityPoly)
     {
         UsedBlowers++;
     }
     if (comp is BubbleEntityPoly)
     {
         UsedBubbles++;
     }
     if (comp is BumperEntityPoly)
     {
         UsedBumps++;
     }
 }
Exemplo n.º 10
0
 public PolyLog(CompEntityPoly comp, List <List <IntPoint> > polys, CompEntityPoly adderComp)
 {
     this.Comp = comp;
     ApPairs   = new List <APPair>();
     AddPoly(polys, adderComp);
 }
Exemplo n.º 11
0
 public PolyLog(CompEntityPoly comp)
 {
     this.Comp = comp;
     ApPairs   = new List <APPair>();
 }
Exemplo n.º 12
0
        private void ExploreSearchSpace(ref List <List <IntPoint> > spaceSoFar,
                                        List <CompEntityPoly> allEntitiesList, CompEntityPoly lastAdder, bool firstTime,
                                        int counter)
        {
            if (counter > 30)
            {
                return;
            }
            else
            {
                if (firstTime)
                {
                    spaceSoFar = BumpersHandler.SetProperBumpersEffect(spaceSoFar,
                                                                       ropesEntityList,
                                                                       allEntitiesList,
                                                                       false);
                }
                else
                {
                    //spaceSoFar = BumpersHandler.SetProperBumpersEffect(spaceSoFar,
                    //                                                   new List<CompEntityPoly>() {lastAdder},
                    //                                                   allEntitiesList,
                    //                                                   false);
                }

                rCompsAll = AreaCompPolyHandler.GetReachServicePolys(spaceSoFar, allEntitiesList);
                rCompsAll = SortBumpsFirst(rCompsAll);
            }

            if (rCompsAll.Count > 0)
            {
                foreach (CompEntityPoly newCovered in rCompsAll)
                {
                    if (newCovered != lastAdder)
                    {
                        if (EntraSolver.IsPolyOperation(lastAdder.GetCoverageSoFar(),
                                                        newCovered.GetDefPoly(), ClipType.ctIntersection))
                        {
                            //if (!ProcessedEntities.Contains(newCovered))
                            if (IsOkToProcess(lastAdder, newCovered))
                            {
                                //IncrementProcessed(newCovered);
                                //if (false)
                                //{
                                //    //EntraDrawer.DrawIntoFileTesting(spaceSoFar);
                                //}
                                //EntraDrawer.DrawIntoFileTesting(spaceSoFar);
                                spaceSoFar = newCovered.ApplyEffect(spaceSoFar, lastAdder);
                                //EntraDrawer.DrawIntoFile(spaceSoFar);

                                //allEntitiesList.Remove(newCovered);

                                ExploreSearchSpace(ref spaceSoFar, allEntitiesList, newCovered, false, counter + 1);
                            }
                        }
                    }
                }
            }

            //spaceSoFar = BumpersHandler.SetProperBumpersEffect(spaceSoFar,
            //                                                   new List<CompEntityPoly>() {lastAdder},
            //                                                   allEntitiesList,
            //                                                   false);
        }