private void ToggleZoomedState(CarouselSlotBehavior carouselSlotBehavior)
        {
            if (isInContentTransition)
            {
                return;
            }

            if (eventAudioManager != null)
            {
                eventAudioManager.PlayAudio();
            }

            var isZoomed = carouselSlotBehavior.IsZoomed;

            if (Souvenir.IsInActiveState)
            {
                UpdateGrid();
            }
            else
            {
                Souvenir.ToggleActiveState();
            }

            if (!isZoomed)
            {
                var yOffset            = GetGameObjectHeight(Souvenir.gameObject);
                var zoomedCoordsObject = TagsHelper.FindChildWithTag(photoArrangement, TagsHelper.ZoomedPictureCoords);
                var position           = transform.InverseTransformPoint(zoomedCoordsObject.transform.position)
                                         - transform.InverseTransformVector(new Vector3(0, yOffset, 0));

                carouselSlotBehavior.EnableZoomedMode(position);
            }
        }
Exemple #2
0
 /// <summary>
 /// Performs initialization related to the active state visuals.
 /// </summary>
 private void InitActiveStateVisuals()
 {
     activeStateVisuals = TagsHelper.FindChildWithTag(gameObject, TagsHelper.ActiveStateVisualsTag);
     if (activeStateVisuals == null)
     {
         Debug.LogError("Could not find the active state visuals child GameObject in the Souvenir.");
     }
 }
        private void Start()
        {
            gazeObserver      = GetComponent <GazeObserver>();
            voiceCommands     = new Dictionary <string, Action>();
            eventAudioManager = EventAudioManager.Instance;

            planeMaterial = Resources.Load <Material>(Constants.ImagePlaneMaterial);
            if (planeMaterial == null)
            {
                Debug.LogError("Could not load the image plane material.");
            }

            presenterManager = FindObjectOfType <ActiveSouvenirManager>();
            if (presenterManager == null)
            {
                Debug.LogError("This script expects a presenter manager component in the scene.");
            }

            if (photoArrangementPrefab == null)
            {
                photoArrangementPrefab = Resources.Load <GameObject>(Constants.PhotoArrangementPrefab);
                if (photoArrangementPrefab == null)
                {
                    Debug.LogError("Could not load photo arrangement prefab.");
                }
            }

            if (photoArrangementPrefab != null)
            {
                photoArrangement = Instantiate(photoArrangementPrefab, transform);

                if (photoArrangement != null)
                {
                    // We want the photo arrangement to be centered with the souvenir.
                    photoArrangement.transform.localPosition    = Vector3.zero;
                    photoArrangement.transform.localEulerAngles = Vector3.zero;

                    photoCoordinates = TagsHelper.FindChildrenWithTag(photoArrangement, TagsHelper.ArrangementPictureCoords);
                    photoNavigator   = TagsHelper.FindChildWithTag(photoArrangement, TagsHelper.PhotoNavigator);
                    loadingIcon      = TagsHelper.FindChildWithTag(photoArrangement, Constants.LoadingIcon);

                    numberOfPresenters = Math.Min(Constants.MaxNumberOfPresenters, photoCoordinates.Count);
                }
                else
                {
                    Debug.LogError("Could not instantiate the photo arrangement prefab.");
                }
            }

            CreatePresenters();

            BindPhotoNavigator();

            if (Souvenir != null)
            {
                carousel.transform.parent = Souvenir.transform;

                Souvenir.ActiveStateEnabled   += EnableGridState;
                Souvenir.ActiveStateDisabled  += EnableCarouselState;
                Souvenir.PassiveStateEnabled  += EnableCarouselState;
                Souvenir.PassiveStateDisabled += EnableSleepingState;
            }

            isInContentTransition = true;
        }