コード例 #1
0
        void trigger(double x, double y, double,
                        shape const& shape,
                        double vx, double vy,
                        uint64_t origin_id,
                        noise_queue& nqueue,
                        comm::msg_queue& queue) {

                std::uniform_int_distribution<int> bmp_dist(0, _images.size() - 1);
                for(uint32_t i = 0; i < _num_debris; ++i) {
                        uint32_t index = _randomize
                                ? bmp_dist(rnd::engine)
                                : (i % _images.size());
                        res::res_id bmp = _images[index];
                        double deb_x, deb_y;
                        std::tie(deb_x, deb_y) = shape.get_random_point();
                        queue.push(comm::create_spawn_debris(
                                                deb_x + x, deb_y + y,
                                                vx, vy,
                                                _vmin, _vmax,
                                                _theta_min, _theta_max,
                                                bmp,
                                                _explode,
                                                origin_id));
                }
        }
コード例 #2
0
        void trigger(double x, double y, double phi,
                        shape const& shape,
                        double, double,
                        uint64_t origin_id,
                        noise_queue& nqueue,
                        comm::msg_queue& queue) {

                double delay = 0.0;
                std::uniform_real_distribution<double> delay_dist(_min_delay, _max_delay);
                for(uint32_t i = 0; i < _num_explosions; ++i) {
                        double expl_x, expl_y;
                        std::tie(expl_x, expl_y) = shape.get_random_point();
                        queue.push(comm::create_spawn_explosion(expl_x + x, expl_y + y), delay);
                        nqueue.push(res::res_id::EXPLOSION_SND, delay);
                        delay += delay_dist(rnd::engine);
                }
        }