#ifndef LIGHT_HH #define LIGHT_HH #include "body.hh" class Light: public Body { protected: int _stimulus; int _gc; Body *_attachment; double _angle1; double _angle_delta; double _strength; public: Light(const Point &, double, double, double, int); Light(Body *, double, double, double, int); virtual ~Light() { } Body *clone(); Body *clone_attachment(Body *); void place(const Point &, double); void reset(); int move_phase() const; bool attached_to(const Body *) const; virtual double strength() const { return _strength; } virtual double angle1() const; virtual double angle_delta() const { return _angle_delta; } double angle2() const { return angle1() + angle_delta(); } int stimulus() const { return _stimulus; } int gc() const { return _gc; } virtual void set_strength(double); bool has_stimulus(int); double stimulus(int, Point, Point &); void move(double); void draw(View *); }; class TimedLight: public Light { int _ticks; int _ticks_left; public: TimedLight(const Point &, double, double, double, int, int); TimedLight(Body *, double, double, double, int, int); Body *clone(); Body *clone_attachment(Body *); void reset(); void move(double); double strength() const; }; class ThresholdLight: public Light { double _threshold; bool _on; public: ThresholdLight(const Point &, double, double, double, int, double); ThresholdLight(Body *, double, double, double, int, double); Body *clone(); Body *clone_attachment(Body *); void sensation(const Vector &); double strength() const { return _on ? _strength : 0; } }; #endif