2022-08-28 20:58:30 +00:00
|
|
|
/* bt_probability.h */
|
|
|
|
|
|
|
|
#ifndef BT_PROBABILITY_H
|
|
|
|
#define BT_PROBABILITY_H
|
|
|
|
|
|
|
|
#include "bt_decorator.h"
|
2022-12-15 07:26:52 +00:00
|
|
|
#include "core/object/object.h"
|
2022-08-28 20:58:30 +00:00
|
|
|
|
|
|
|
class BTProbability : public BTDecorator {
|
|
|
|
GDCLASS(BTProbability, BTDecorator);
|
|
|
|
|
|
|
|
private:
|
|
|
|
float run_chance = 0.5;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
virtual String _generate_name() const override;
|
2023-04-10 08:08:11 +00:00
|
|
|
virtual int _tick(double p_delta) override;
|
2022-08-28 20:58:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
void set_run_chance(float p_value) {
|
|
|
|
run_chance = p_value;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
float get_run_chance() const { return run_chance; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BT_PROBABILITY_H
|