Exemplo n.º 1
0
        public void OnPointerHover()
        {
            ComponentHelpers.CallLateUpdate(laserVisual);
            Assert.AreEqual(reticle.transform.position, DEFAULT_RETICLE_POS);

            pointer.OnPointerHover(raycastResult, true);
            ComponentHelpers.CallLateUpdate(laserVisual);


            Assert.AreEqual(reticle.transform.position, CLOSE_HIT_POS);
        }
Exemplo n.º 2
0
        public void OnPointerEnterFar()
        {
            ComponentHelpers.CallLateUpdate(laserVisual);
            Assert.AreEqual(reticle.transform.position, DEFAULT_RETICLE_POS);

            raycastResult.worldPosition = FAR_HIT_POS;
            raycastResult.distance      = FAR_HIT_POS.z;
            pointer.OnPointerEnter(raycastResult, true);
            ComponentHelpers.CallLateUpdate(laserVisual);

            Assert.AreEqual(reticle.transform.position, FAR_HIT_POS);
        }
Exemplo n.º 3
0
    /// Substitute a class that extends from Monobehaviour and add it to the GameObject passed in.
    /// Remember, all non-virtual members will actually be executed. Only virtual/abstract members
    /// can be recorded or have return values specified.
    /// Additionally, call OnEnable and Awake on the component after it is added to the GameObject.
    public static T ForInvokeLifecycle <T>(GameObject gameObject)
        where T : MonoBehaviour
    {
        T result = SubstituteComponent.For <T>(gameObject);

        if (result == null)
        {
            return(null);
        }

        ComponentHelpers.CallOnEnable(gameObject);
        ComponentHelpers.CallAwake(gameObject);

        return(result);
    }
Exemplo n.º 4
0
        private static void FindComponentsWithContent(string v)
        {
            var components = ComponentHelpers.LoadAllComponentsByPublication();

            Parallel.ForEach(components,
                             new ParallelOptions
            {
                MaxDegreeOfParallelism = Settings.MaxThreads
            },
                             component =>
            {
                var item = ItemHelpers.LoadItem <ComponentData>(component.Id);
                Logger.Debug("Processing Component {0}", item.Id);
                if (item.Content.ToLowerInvariant().Contains(v))
                {
                    Logger.Info("{0}", item.Id);
                }
            }
                             );
        }
Exemplo n.º 5
0
        public void Setup()
        {
            GameObject laserObj = new GameObject();

            laserObj.AddComponent <LineRenderer>();
            laserVisual = ComponentHelpers.AddComponentInvokeLifecycle <GvrLaserVisual>(laserObj);
            laserVisual.lerpThreshold = 0.0f;

            pointer                        = ComponentHelpers.AddComponentInvokeLifecycle <GvrLaserPointer>(laserObj);
            pointer.raycastMode            = GvrBasePointer.RaycastMode.Direct;
            pointer.maxPointerDistance     = MAX_RETICLE_DISTANCE;
            pointer.defaultReticleDistance = MAX_RETICLE_DISTANCE;
            ComponentHelpers.CallStart(pointer);

            reticle             = new GameObject();
            laserVisual.Reticle = reticle.transform;

            raycastResult.worldPosition = CLOSE_HIT_POS;
            raycastResult.distance      = CLOSE_HIT_POS.z;
        }
Exemplo n.º 6
0
        public void Setup()
        {
            GameObject reticleObj = new GameObject();

            pointer = ComponentHelpers.AddComponentInvokeLifecycle <GvrReticlePointer>(reticleObj);
        }