示例#1
0
            public void when_add_a_new_game_object_should_work()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player    = new UnityEngine.GameObject();
                UnityEngine.Collision  collision = new UnityEngine.Collision();
                Collision_info         info      = new Collision_info("test", collision, player);

                manager.add(info);
                Assert.IsNotNull(manager[player]);
                Assert.IsTrue(manager[player, "test"]);
            }
示例#2
0
            public void get_status_should_work()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player = new UnityEngine.GameObject();

                Assert.IsFalse(manager["test"]);

                UnityEngine.Collision collision = new UnityEngine.Collision();
                Collision_info        info      = new Collision_info("test", collision, player);

                manager.add(info);

                Assert.IsTrue(manager["test"]);
                Assert.IsFalse(manager["asdf"]);
            }
示例#3
0
            public void get_a_event_when_no_exists_should_return_false()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player = new UnityEngine.GameObject();

                Assert.IsFalse(manager[player, "test"]);

                UnityEngine.Collision collision = new UnityEngine.Collision();
                Collision_info        info      = new Collision_info("test", collision, player);

                manager.add(info);

                Assert.IsTrue(manager[player, "test"]);
                Assert.IsFalse(manager[player, "asdf"]);
            }
示例#4
0
            public void after_remove_should_return_null_with_gameobject()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player = new UnityEngine.GameObject();

                Assert.IsFalse(manager["test"]);

                UnityEngine.Collision collision = new UnityEngine.Collision();
                Collision_info        info      = new Collision_info("test", collision, player);

                manager.add(info);

                Assert.IsTrue(manager["test"]);
                manager.remove(player);
                Assert.IsNull(manager[player]);
            }
示例#5
0
            public void when_add_two_obj_shold_work()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player     = new UnityEngine.GameObject();
                UnityEngine.GameObject enamy      = new UnityEngine.GameObject();
                UnityEngine.Collision  collision  = new UnityEngine.Collision();
                Collision_info         info       = new Collision_info("test", collision, player);
                Collision_info         info_enemy = new Collision_info("test", collision, enamy);

                manager.add(info);
                manager.add(info_enemy);

                Assert.IsNotNull(manager[player]);
                Assert.IsTrue(manager[player, "test"]);
                Assert.IsNotNull(manager[enamy]);
                Assert.IsTrue(manager[enamy, "test"]);
            }
示例#6
0
            public void remove_twice_should_be_fine()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player = new UnityEngine.GameObject();

                Assert.IsFalse(manager["test"]);

                UnityEngine.Collision collision = new UnityEngine.Collision();
                Collision_info        info      = new Collision_info("test", collision, player);

                manager.add(info);

                Assert.IsTrue(manager["test"]);
                manager.remove(player);
                Assert.IsNull(manager[player]);
                manager.remove(player);
                Assert.IsNull(manager[player]);
            }
示例#7
0
            public void get_a_object_is_not_in_the_manager_should_return_null()
            {
                Collision manager = new Collision();

                UnityEngine.GameObject player = new UnityEngine.GameObject();
                UnityEngine.GameObject enemy  = new UnityEngine.GameObject();

                Assert.IsNull(manager[enemy]);
                Assert.IsNull(manager[player]);
                Assert.IsFalse(manager[enemy, "test"]);
                Assert.IsFalse(manager[player, "test"]);

                UnityEngine.Collision collision = new UnityEngine.Collision();
                Collision_info        info      = new Collision_info("test", collision, player);

                manager.add(info);

                Assert.IsNull(manager[enemy]);
                Assert.IsNotNull(manager[player]);
                Assert.IsFalse(manager[enemy, "test"]);
                Assert.IsTrue(manager[player, "test"]);
            }