Beispiel #1
0
        /// <summary>
        /// Gibt einen zufälligen Intervall zurück
        /// </summary>
        /// <returns></returns>
        private int GenerateInterval()
        {
            const int maxInterval = 7;
            const int minInterval = 20;

            return(RandomUtil.Generate(maxInterval, minInterval));
        }
Beispiel #2
0
        string RandName(int lenMin = 3, int lenMax = 8)
        {
            char[] possibleCharacters = ("abcdefghijklmnopqrstuvwxyz"
                                         + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                         + "01234567890")
                                        .ToCharArray();
            int len = Random.Range(lenMin, lenMax + 1);

            return(new string(RandomUtil.Generate(() => possibleCharacters.RandomPick(), len).ToArray()));
        }
Beispiel #3
0
        /// <summary>
        /// Erstellt ein Item, am oberen Formrand an einer Zufälligen X-Koordinate
        /// </summary>
        private void Cretate()
        {
            Destoryed = false;

            X = RandomUtil.Generate(0, _game.ContainerWidth);

            if (_rectItem.IsEmpty)
            {
                _rectItem = _graphicUtil.CreateRectangle(X, Y, Width, Height);
            }

            _rectItem.Y = Y;
            _rectItem.X = X;
            _intervalTimer.Restart();
            _interval = GenerateInterval();

            _graphicUtil.FillRectangle(_rectItem, _itemColor);
        }
Beispiel #4
0
        void RandomGenerate(RankKind kind, int lengthTop, int lengthAroundPlayer)
        {
            var allTimes = RandomUtil
                           .Generate(() => Random.Range(20f, 100f), lengthTop + lengthAroundPlayer)
                           .OrderBy(time => time);

            RankDatum[] top = allTimes
                              .Take(lengthTop)
                              .Select((time, i) => new RankDatum(RandName(), i + 1, time))
                              .ToArray();

            RankDatum[] aroundYou = allTimes
                                    .Skip(lengthTop)
                                    .Select((time, i) => new RankDatum(RandName(), lengthTop + 67 + i + 1, time)) //67は適当
                                    .ToArray();

            datas[(int)kind] = new RankData(kind, top, aroundYou);
        }
Beispiel #5
0
        /// <summary>
        /// Generiert neue Koordinaten für kleine Stein, wo vorher der Komplette Stein stand
        /// </summary>
        private void CreateLittleRocks(int countRocks)
        {
            if (_recLittleRocks == null)
            {
                _graphicUtil.FillRectangle(_recRock, _removeColor);
            }
            else
            {
                _graphicUtil.FillRectangles(_recLittleRocks, _removeColor);
            }

            _recLittleRocks = new Rectangle[countRocks];

            for (var i = 0; i < _recLittleRocks.Length; i++)
            {
                var locationX = RandomUtil.Generate(LocationX, LocationX + Width);
                var locationY = RandomUtil.Generate(LocationY, LocationY + Hight);

                _recLittleRocks[i] = _graphicUtil.CreateRectangle(locationX, locationY, 5, 5);
            }

            _graphicUtil.FillRectangles(_recLittleRocks, _color);
        }