Esempio n. 1
0
 public static Goal makeGoal(string type, char speedType, SizeCoordObject target)
 {
     // method creats goal
     if (type == "hunt" || type == "sleep" || type == "eat" || type == "drink" || type == "walk")
     {
         return(new HuntOrRecoveryGoal(type, speedType, target));
     }
     else if (type == "reproduce")
     {
         return(new ReproduceGoal(speedType, target));
     }
     else
     {
         return(new RunAwayGoal(target));
     }
 }
Esempio n. 2
0
 public HuntOrRecoveryGoal(string type, char speedType, SizeCoordObject target) : base(speedType, target)
 {
     this.type = type;
 }
Esempio n. 3
0
 public Goal(char speedType, SizeCoordObject target)
 {
     this.speedType = speedType;
     this.target    = target;
 }
Esempio n. 4
0
 public double distance(SizeCoordObject obj1, SizeCoordObject obj2)
 {
     return(Math.Sqrt(Math.Pow(obj2.coords.X - obj1.coords.X, 2) + Math.Pow(obj2.coords.Y - obj1.coords.Y, 2)) - (obj1.size / 2 + obj2.size / 2));
 }
 public ReproduceGoal(char speedType, SizeCoordObject target) : base(speedType, target)
 {
     this.type = "reproduce";
 }
Esempio n. 6
0
 public RunAwayGoal(SizeCoordObject target) : base('r', target)
 {
     type         = "run away";
     runAwayPlace = target;
 }