コード例 #1
0
        public IEnumerator TestDestroy()
        {
            AssembleInteractableButton(
                out Interactable interactable,
                out Transform translateTargetObject);

            // Put GGV focus on the Interactable button
            CameraCache.Main.transform.LookAt(interactable.transform.position);

            yield return(new WaitForSeconds(EaseDelay));

            var propBlock = InteractableThemeShaderUtils.GetPropertyBlock(translateTargetObject.gameObject);

            Assert.AreEqual(propBlock.GetColor("_Color"), FocusColor);

            // Destroy the interactable component
            GameObject.Destroy(interactable);

            // Remove focus
            CameraCache.Main.transform.LookAt(Vector3.zero);

            yield return(null);

            propBlock = InteractableThemeShaderUtils.GetPropertyBlock(translateTargetObject.gameObject);
            Assert.AreEqual(propBlock.GetColor("_Color"), FocusColor);
        }
コード例 #2
0
        public IEnumerator TestDisabledStateThemes()
        {
            AssembleInteractableButton(
                out Interactable interactable,
                out Transform translateTargetObject);

            CameraCache.Main.transform.LookAt(interactable.transform.position);

            yield return(new WaitForSeconds(EaseDelay));

            var propBlock = InteractableThemeShaderUtils.GetPropertyBlock(translateTargetObject.gameObject);

            Assert.AreEqual(propBlock.GetColor("_Color"), FocusColor);

            interactable.IsEnabled = false;

            yield return(new WaitForSeconds(EaseDelay));

            propBlock = InteractableThemeShaderUtils.GetPropertyBlock(translateTargetObject.gameObject);
            Assert.AreEqual(propBlock.GetColor("_Color"), DisabledColor);
            Assert.False(interactable.IsEnabled);
            Assert.False(interactable.HasFocus);

            GameObject.Destroy(interactable.gameObject);
        }