Exemple #1
0
        public PipeWave(FlappyMagi game)
        {
            this._game = game;
            this._resourceManager = game.ResourceManager;

            _texPipeTop = _resourceManager.GetTexture("Pipe/top");
            _texPipeBottom = _resourceManager.GetTexture("Pipe/bottom");

            int startX = _startX;
            for (int i = 0; i < 3; ++i)
            {
                var ys = SelectPipePos();
                float y1 = ys.Item1;
                float y2 = ys.Item2;

                Pipe pipeTop = new Pipe(new Vector2(startX + i * _pipeStride, y1), _texPipeTop);
                Pipe pipeBottom = new Pipe(new Vector2(startX + i * _pipeStride, y2), _texPipeBottom);
                _pipes.Enqueue(pipeTop);
                _pipes.Enqueue(pipeBottom);
            }
        }
Exemple #2
0
        /// <summary>
        /// Reset the pipe wave and all pipes the same.
        /// </summary>
        public void Reset()
        {
            _score = 0;

            _pipes.Clear();
            int startX = _startX;
            for (int i = 0; i < 3; ++i)
            {
                var ys = SelectPipePos();
                float y1 = ys.Item1;
                float y2 = ys.Item2;

                Pipe pipeTop = new Pipe(new Vector2(startX + i * _pipeStride, y1), _texPipeTop);
                Pipe pipeBottom = new Pipe(new Vector2(startX + i * _pipeStride, y2), _texPipeBottom);
                _pipes.Enqueue(pipeTop);
                _pipes.Enqueue(pipeBottom);
            }
        }