示例#1
0
 public void InteractiveObjectsManagerInitiatesWithEmptyObject()
 {
     Player.InteractiveObjectsManager interactiveObjectsManager = new Player.InteractiveObjectsManager();
     if (interactiveObjectsManager.InteractiveObjectInRange)
     {
         Assert.Fail("Interactive object manager stores a non empty object as InteractiveObjectInRange value");
     }
 }
示例#2
0
        public void InteractiveObjectManagerDetectsObject()
        {
            GameObject    gameObject = new GameObject();
            BoxCollider2D collider   = gameObject.AddComponent <BoxCollider2D>();

            gameObject.layer = 9;
            gameObject.name  = "testInteractable";
            gameObject.transform.position = Vector3.zero;
            Player.InteractiveObjectsManager interactiveObjectsManager = new Player.InteractiveObjectsManager();

            // Act
            interactiveObjectsManager.CheckForInteractiveObjectsInRange(Vector3.zero, Vector3.right);

            // Assert
            Assert.AreEqual(collider, interactiveObjectsManager.InteractiveObjectInRange.collider);
            gameObject.SetActive(false);
        }
示例#3
0
        public void InteractiveObjectManagerOverriderDetectedObject()
        {
            GameObject    gameObject  = new GameObject();
            BoxCollider2D collider    = gameObject.AddComponent <BoxCollider2D>();
            IInteractive  interactive = gameObject.AddComponent <Sign>();

            gameObject.layer = 9;
            gameObject.name  = "testInteractable";
            gameObject.transform.position = Vector3.zero;
            Player.InteractiveObjectsManager interactiveObjectsManager = new Player.InteractiveObjectsManager();

            // Act
            interactiveObjectsManager.CheckForInteractiveObjectsInRange(Vector3.zero, Vector3.right);
            gameObject.SetActive(false);
            interactiveObjectsManager.CheckForInteractiveObjectsInRange(Vector3.zero, Vector3.right);
            if (interactiveObjectsManager.InteractiveObjectInRange)
            {
                Assert.Fail("Interactive object manager stores a non empty object as InteractiveObjectInRange value");
            }
        }