home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 07 DecisionMaking Architectures / 01 Isla, Blumberg / Skill.java < prev    next >
Encoding:
Java Source  |  2001-09-25  |  1.3 KB  |  56 lines

  1. package bb;
  2.  
  3. import java.awt.*;
  4. import java.awt.geom.*;
  5.  
  6. /*
  7. The base class for all skills.
  8. As it turns out, all skills have a name and a proficiency.
  9.  
  10. It is assumed that the skill's "activate" method will be called when
  11. the skill starts being used, and that its "deactivate" method will be
  12. called when the skill (or mission) is finished. To make the skill actually
  13. perform its action, the "apply" method is called.
  14.  
  15. @author naimad
  16. */
  17.  
  18. public abstract class Skill {
  19.  
  20.     Agent agent;
  21.     String name;
  22.     
  23.     double proficiency = 1.0;
  24.     
  25.     public Skill(String name, Agent agent) {
  26.         this.agent = agent;
  27.         this.name = name;
  28.     }
  29.  
  30.     public Skill(String name, Agent agent, double prof) {
  31.         this.agent = agent;
  32.         this.name = name;
  33.         this.proficiency = prof;
  34.     }
  35.     
  36.     String getName() {
  37.         return name;
  38.     }
  39.     
  40.     //apply this skill to this mission.
  41.     //could involve moving the agent around.
  42.     public abstract void apply(double time, Mission mission);
  43.     
  44.     public double getProficiency() {
  45.         return proficiency;
  46.     }
  47.     
  48.     public void drawSkill(double time, Graphics2D g2) {
  49.         //do nothing
  50.     }
  51.     
  52.     public void activate() {}
  53.     
  54.     public void deActivate(){}
  55. }
  56.