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)); } }
public HuntOrRecoveryGoal(string type, char speedType, SizeCoordObject target) : base(speedType, target) { this.type = type; }
public Goal(char speedType, SizeCoordObject target) { this.speedType = speedType; this.target = target; }
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"; }
public RunAwayGoal(SizeCoordObject target) : base('r', target) { type = "run away"; runAwayPlace = target; }