addObject() public method

public addObject ( Vector2 Pos, int ID, float Width, float Height ) : void
Pos Vector2
ID int
Width float
Height float
return void
示例#1
0
 public void addObjectTest()
 {
     ActionHandler target = new ActionHandler();
     Vector2 Pos = new Vector2(300, 200);
     int ID = 208;
     float Height = 30F;
     float Width = 30F;
     target.addObject(Pos, ID, Height, Width);
     Assert.IsTrue(target.getPos(ID) == Pos, "Position fail");
     Assert.IsTrue(target.getWidth(ID) == Width, "Width fail");
     Assert.IsTrue(target.getHeight(ID) == Height, "Height fail ");
 }
示例#2
0
 public void VisibilityTest1()
 {
     ActionHandler target = new ActionHandler();
     //Object Assignment
     target.addObject(new Vector2(300, 250), 0, 30, 30);
     target.addObject(new Vector2(100, 100), 101, 90, 90);
     target.addObject(new Vector2(0, 0), 102, 90, 90);
     target.addObject(new Vector2(400, 240), 103, 90, 90);
     //Enemy Position is changed
     target.addObject(new Vector2(600, 250), 201, 35, 35);
     int ID1 = 201; //Enemy
     int ID2 = 0;   //Character
     //Vector2(-999, -999) is returned when enemy didn't find
     Vector2 expected = new Vector2(-999, -999);
     Vector2 actual;
     actual = target.Visibility(ID1, ID2);
     Assert.AreEqual(expected, actual); //true
 }