예제 #1
0
        public Cave InitializeCave(Cave cave)
        {
            _iterationCount = 50;

            for (int x = 0; x < Utility.WIDTH; x++)
            {
                for (int y = 0; y < Utility.HEIGTH; y++)
                {
                    cave._celullarMap[x, y].state = Utility.STATE.Rock;
                }
            }

            RWalkSeeds = new List <AARandWalkStrategy>();

            for (int i = 0; i < seedNumber; i++)
            {
                AARandWalkStrategy seed = new AARandWalkStrategy(
                    CustomRandomNumberGenerator.GetRandomInt(40, 90),
                    CustomRandomNumberGenerator.GetRandomInt(20, 55)
                    );
                cave._celullarMap[seed._x, seed._y].state = Utility.STATE.Air;
                RWalkSeeds.Add(seed);
            }

            return(cave);
        }
        private void CreateSeed()
        {
            seeds = new List <AASeedStrategy>();

            int seedNumber = CustomRandomNumberGenerator.GetRandomInt(6, 10);

            int seedDistance = Utility.WIDTH / seedNumber;

            for (int i = 1; i < seedNumber; i++)
            {
                int trueDistance = 0;
                while ((i * trueDistance <= 0 || i * trueDistance >= Utility.WIDTH))
                {
                    trueDistance = seedDistance + CustomRandomNumberGenerator.GetRandomInt(-2, 2);
                }
                seeds.Add(new AASeedStrategy(i * trueDistance, _floorLimit - 1));
            }
        }
        private void Move()
        {
            int number = CustomRandomNumberGenerator.GetRandomInt(1, 5);

            Debug.WriteLine(number);

            if (number == 1)
            {
                _y--;
            }
            else if (number == 2)
            {
                _y++;
            }
            else if (number == 3)
            {
                _x--;
            }
            else if (number == 4)
            {
                _x++;
            }
        }