Ejemplo n.º 1
0
        public bool Explore(IActor player, ILocations locations, int count)
        {
            var j = locations.GetEnumerator();

            if (locations as ExitLocations != null)
            {
                if (count > 0)
                {
                    while (j.MoveNext())
                    {
                        Explore(player, j.Current as ILocations, count--);

                    }

                }
                else
                {
                    locations.EnterLocation(player);
                    locations.ExitLocation(player);
                    return false;
                }

            }

            var t =  (locations as ContainerLocation).GetPlayerMarker(player);

            if (t.Equals(null))
            {

                locations.EnterLocation(player);
                locations.ExitLocation(player);
                while (j.MoveNext())
                {

                    Explore(player, j.Current as ILocations, count--);

                }

            }
            if(t.Equals(Marker._green))
            {
                locations.EnterLocation(player);
                locations.ExitLocation(player);
                while (j.MoveNext())
                {

                    Explore(player, j.Current as ILocations, count);

                }

            }

            return false;
        }
Ejemplo n.º 2
0
        ///<summary>
        /// allows the exploration and adds to the build log
        ///</summary>
        private void Explore(ILocations location)
        {
            if((_set.Contains(location) ) == false)
            {
                BuildLog(location);
                _set.Add(location);

                var j = location.GetEnumerator();
                while (j.MoveNext())
                {
                    if (j.Current != null)
                    {
                        Explore(j.Current as ILocations);
                    }

                }

            }
            return;
        }
Ejemplo n.º 3
0
        public void Explore(IActor player, ILocations locations, Control flag)
        {
            if (flag.Flag == true)
            {
                var j = locations.GetEnumerator();

                var t = ((ILocationDecorator) locations).GetPlayerMarker(player);

                if (locations as IExit != null && flag.Flag == true)
                {

                    locations.EnterLocation(player);
                     locations.ExitLocation(player);
                    flag.Flag = false;

                    //if ((flag.Count > 0 && t == null))
                   // {
                       // locations.EnterLocation(player);
                       // locations.ExitLocation(player);
                       // var i = flag.Count;
                       // flag.Count = (i - 1);
                       // return;
                        /*

                        while (j.MoveNext())
                        {
                            if (j.Current != null)
                            {
                                if (((LocationDecorator) j.Current).GetPlayerMarker(player) != null)
                                {
                                    if (!((LocationDecorator) j.Current).GetPlayerMarker(player).Equals(Marker._red))
                                    {
                                        Explore(player, j.Current as ILocations, flag);
                                    }

                                }
                                else if (((LocationDecorator) j.Current).GetPlayerMarker(player) == null)
                                {
                                    Explore(player, j.Current as ILocations, flag);

                                }
                            }
                        */
                    }

                  //  if (t != null && flag.Count < 1)
                   // {
                        //locations.EnterLocation(player);
                       // locations.ExitLocation(player);
                       // flag.Flag = false;
                       // return;

                        /*
                            while (j.MoveNext())
                            {
                                if (j.Current != null)
                                {
                                    if (((LocationDecorator) j.Current).GetPlayerMarker(player) != null)
                                    {
                                        if (!((LocationDecorator) j.Current).GetPlayerMarker(player).Equals(Marker._red))
                                        {
                                            Explore(player, j.Current as ILocations, count, flag);
                                        }

                                    }
                                    else if (((LocationDecorator) j.Current).GetPlayerMarker(player) == null)
                                    {
                                        Explore(player, j.Current as ILocations, count, flag);

                                    }
                                }

                            }
                            */
                   // }

               // }

                if (t == null && flag.Flag == true)
                {

                       goto Loop;

                }
                else if (((ILocationDecorator) locations).GetPlayerMarker(player).Equals(Marker._green) &&
                         flag.Flag == true)
                {
                     goto Loop;

                }

               //Goto comes here
               Loop:

                locations.EnterLocation(player);
                locations.ExitLocation(player);

                while (j.MoveNext())
                {
                    if (j.Current != null)
                    {
                        if (((ILocationDecorator)j.Current).GetPlayerMarker(player) != null)
                        {
                            if (((ILocationDecorator)j.Current).GetPlayerMarker(player).Equals(Marker._green))
                            {
                                Explore(player, j.Current as ILocations, flag);
                            }
                        }
                        else if (((ILocationDecorator)j.Current).GetPlayerMarker(player) == null)
                        {
                            Explore(player, j.Current as ILocations, flag);
                        }
                    }

                }

                return;

            }
        }