00001 #ifndef _ROBOTOBJECT_H 00002 #define _ROBOTOBJECT_H 00003 00004 #include <vector> 00005 #include "CodeTool.h" 00006 00007 class Robot; 00008 00009 00010 class RobotObject 00011 { 00012 public: 00013 RobotObject(Robot& ); 00014 virtual ~RobotObject(); 00015 00016 virtual void Tick(long usec); 00017 00018 virtual long get_property(int) = 0; 00019 virtual void set_property(int,long) = 0; 00020 virtual long call_method(int,stack_v&) = 0; 00021 00022 int GetMaxLife() { return m_max_life; } 00023 void SetMaxLife(int x) { m_max_life = x; } 00024 int GetLife() { return (int)m_life; } 00025 void SetLife(int x) { m_life = (double)x; } 00026 int GetDamage() { return (int)((m_life * 100) / m_max_life); } 00027 bool Ok() { return GetDamage() > 0; } 00028 void SetRepairRate(int x) { m_repair_rate = x; } 00029 int GetRepairRate() { return m_repair_rate; } 00030 00031 Robot& GetRobot() { return m_robot; } 00032 00033 private: 00034 Robot& m_robot; 00035 int m_max_life; 00036 double m_life; 00037 int m_repair_rate; // % of max power/sec - 100 power units repair 1 life 00038 }; 00039 00040 00041 00042 #endif // _ROBOTOBJECT_H