Waste.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. 
  2. namespace MultiAgentSystemPCL
  3. {
  4. public class Waste : ObjectInWorld
  5. {
  6. private const double PROBA_DECREASE = 0.6;
  7. protected int type;
  8. public int Type
  9. {
  10. get { return type; }
  11. }
  12. protected int size = 1;
  13. public int Size
  14. {
  15. get { return size; }
  16. }
  17. public int Zone
  18. {
  19. get { return 10 + (8 * size - 1); }
  20. }
  21. public Waste(double _posX, double _posY, int _type)
  22. {
  23. PosX = _posX;
  24. PosY = _posY;
  25. type = _type;
  26. }
  27. public Waste(Waste _goal)
  28. {
  29. PosX = _goal.PosX;
  30. PosY = _goal.PosY;
  31. type = _goal.type;
  32. }
  33. internal void Decrease()
  34. {
  35. size--;
  36. }
  37. internal void Increase()
  38. {
  39. size++;
  40. }
  41. internal double ProbaToTake()
  42. {
  43. double proba = 1.0;
  44. for (int i = 1; i < size; i++)
  45. {
  46. proba *= PROBA_DECREASE;
  47. }
  48. return proba;
  49. }
  50. }
  51. }