ActionHandler Detects Collision and Check Visivility of Enemy. This class use only values of sprites not reference, so this needs to update each movement. ::Future possible development:: Position List can be converted to sprite list which is referece type. No need to update each movement,but need to change most of codes.
예제 #1
0
 public void CollisionCheckTest()
 {
     ActionHandler target = new ActionHandler(); // TODO: Initialize to an appropriate value
     int ID = 0; // TODO: Initialize to an appropriate value
     Vector2 expected = new Vector2(0,0); // TODO: Initialize to an appropriate value
     Vector2 actual;
     actual = target.CollisionCheck(ID);
     Assert.AreEqual(expected, actual);
 }
예제 #2
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 ");
 }
예제 #3
0
 public void ActionHandlerConstructorTest()
 {
     ActionHandler target = new ActionHandler();
     Assert.IsNotNull(target);
 }
예제 #4
0
        public void UpdatePosTest1()
        {
            ActionHandler target = new ActionHandler();
            Sprite name = new Sprite();
            name.SpriteID = 15;

            name.updatePos(new Vector2(100, 299));

            target.UpdatePos(name);
            Assert.IsTrue(name.pos == target.getPos(name.SpriteID));
        }
예제 #5
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
 }
예제 #6
0
 public void RecognizeObjectTest()
 {
     ActionHandler target = new ActionHandler(); // TODO: Initialize to an appropriate value
     Sprite name = null; // TODO: Initialize to an appropriate value
     target.RecognizeObject(name);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
예제 #7
0
 public void IgnoreObjectTest()
 {
     ActionHandler target = new ActionHandler(); // TODO: Initialize to an appropriate value
     Sprite name = new Sprite(); // TODO: Initialize to an appropriate value
     target.IgnoreObject(name);
 }
예제 #8
0
 public void getWidthTest()
 {
     ActionHandler target = new ActionHandler();
     int ID = 0;
     double expected = 45F;
     double actual;
     actual = target.getWidth(ID);
     Assert.AreEqual(expected, actual);
 }
예제 #9
0
 public void getPosTest()
 {
     ActionHandler target = new ActionHandler();
     int ID = 5;
     Vector2 expected = new Vector2(100, 200);
     Vector2 actual;
     actual = target.getPos(ID);
     Assert.AreEqual(expected, actual);
 }
예제 #10
0
 public void getHeightTest()
 {
     ActionHandler target = new ActionHandler();
     int ID = 12;
     double expected = 30F;
     double actual;
     actual = target.getHeight(ID);
     Assert.AreEqual(expected, actual);
 }