Exemplo n.º 1
0
        public void GetOffscreenEndpoint_ReturnsEndpoint()
        {
            //  prereq
            GetEndpointAtDistance_ReturnsEndpoint();
            UtilTest.UtilTest util = new UtilTest.UtilTest();
            util.IsOnScreen_ReturnsCorrectly();

            //  clean up
            TestHelper.ResetAllCameras();

            //  arrange
            GameObject gameObject = new GameObject();

            gameObject.AddComponent(typeof(Camera));
            Camera cam = gameObject.GetComponent <Camera>();

            cam.transform.position = Vector3.back * 10;
            cam.transform.forward  = Vector3.forward;

            //  act
            Vector3 endpointImplied  = PMath.GetOffscreenEndpoint(Vector3.zero, Vector3.right);
            Vector3 endpointExplicit = PMath.GetOffscreenEndpoint(Vector3.zero, Vector3.right, cam);

            //  assert
            bool onScreenImp = PLib.General.PUtil.IsOnScreen(endpointImplied, cam);
            bool onScreenExp = PLib.General.PUtil.IsOnScreen(endpointExplicit, cam);

            Assert.IsFalse(onScreenImp, "endpoint: " + endpointImplied.ToString());
            Assert.IsFalse(onScreenExp, "endpoint: " + endpointExplicit.ToString());
        }