示例#1
0
    public void ColumnCoords() {
      var m1 = new MoveableItem(1, 1, 10);
      var m2 = new MoveableItem(1, 5, 10);

      var distanceCalc = new DistanceCalculator();
      int distance = distanceCalc.distance(m1, m2);

      Assert.AreEqual(4, distance);
    }
示例#2
0
    public void Colliding() {
      var m1 = new MoveableItem(1, 1, 10);
      var m2 = new MoveableItem(1, 1, 10);

      var distanceCalc = new DistanceCalculator();
      int distance = distanceCalc.distance(m1, m2);

      Assert.AreEqual(0, distance);
    }
示例#3
0
    public void DefiningTheMs() {
      var m1 = new MoveableItem(8, 1, 10);
      var m2 = new MoveableItem(1, 5, 10);

      var distanceCalc = new DistanceCalculator();
      int distance = distanceCalc.distance(m1, m2);

      Assert.AreEqual(9, distance);
    }
示例#4
0
    public void UpdateWithPlayer(Player player) {
      var calculateDistance = new DistanceCalculator();
      var distance = calculateDistance.distance(this._Item, player._Item);


      if (distance < 4) {
        _PlayerGotTooClose = true;
      }
      if (distance == 0) {
        _PlayerCollidedWithCollectable = true;
        player.currentNumberOfCollectedItems += 1;
      }
    }