コード例 #1
0
        public EntraResult CheckPlayability(EngineManager engineState)
        {
            SetMembers(engineState);
            List <List <IntPoint> > reachableSpace = new List <List <IntPoint> >();

            FindWorkingSpace(ref reachableSpace);
            var frogEntity = new FrogEntityPoly(this, StaticData.EngineManager.FrogRB);
            List <List <IntPoint> > frogCompsInter = EntraSolver.GetPolySolution(reachableSpace, frogEntity.GetDefPoly(),
                                                                                 ClipType.ctIntersection);

            if (frogCompsInter.Count > 0)
            {
                //if (CanCookieFitInIntersection(StaticData.EngineManager.CookieRB, solution))
                //MessageBox.Show("The level is playable, recognized by Entra Agent.");
                return(new EntraResult(StaticData.EngineManager.FrogRB.PositionXNACenter2D,
                                       frogEntity.GetDefPoly(),
                                       frogCompsInter,
                                       reachableSpace,
                                       true));
            }
            return(new EntraResult(StaticData.EngineManager.FrogRB.PositionXNACenter2D,
                                   frogEntity.GetDefPoly(),
                                   frogCompsInter,
                                   reachableSpace,
                                   false));
        }
コード例 #2
0
        private void FindWorkingSpace(ref List <List <IntPoint> > spaceSoFar)
        {
            ropesEntityList   = _entityBuilder.GetRopesEntities();
            rocketsEntityList = _entityBuilder.GetRocketsEntities();
            blowersEntityList = _entityBuilder.GetBlowersEntities();
            bubblesEntityList = _entityBuilder.GetBubblesEntities();
            bumpersEntityList = _entityBuilder.GetBumpersEntities();

            List <CompEntityPoly> allEntitiesList = new List <CompEntityPoly>();

            allEntitiesList.AddRange(rocketsEntityList);
            allEntitiesList.AddRange(blowersEntityList);
            allEntitiesList.AddRange(bubblesEntityList);
            allEntitiesList.AddRange(bumpersEntityList);

            spaceSoFar = GetRopesAreaPolys(ropesEntityList.Cast <RopeEntityPoly>().ToList());
            spaceSoFar = BumpersHandler.SetProperBumpersEffect(spaceSoFar, ropesEntityList, allEntitiesList, false);



            ExploreSearchSpace(ref spaceSoFar, allEntitiesList, ropesEntityList[0], true, 0);

            List <List <IntPoint> > result = new List <List <IntPoint> >();

            foreach (PolyLog polyLog in this.PolysLogger.Logs)
            {
                result = EntraSolver.GetPolySolution(result, polyLog.PolysUnion, ClipType.ctUnion);
            }
            spaceSoFar = result;
        }
コード例 #3
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);
        }
コード例 #4
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);
        }