Beispiel #1
0
        private void OnItemGazedAt(object sender, GazeEventArgs eventArguments)
        {
            if (eventArguments.Hit.GetComponent <CurvedUIButton>() != null)
            {
                pillars.UIController.GazedAt(eventArguments.Hit.GetComponent <CurvedUIButton>());
                return;
            }

            MenuNode hitNode = eventArguments.Hit.GetComponent <MenuNode>();

            // Maybe we hit a reference node
            if (hitNode == null)
            {
                ReferenceNode reference = eventArguments.Hit.GetComponent <ReferenceNode>();
                hitNode = (reference != null) ? reference.Node : null;
            }

            // Still nothing
            if (hitNode == null)
            {
                return;
            }

            MenuNode node = null;

            // When on the galaxy, only select planets
            if (selectedNode.NodeType == MenuNodeType.Galaxy && hitNode.NodeType == MenuNodeType.Planet)
            {
                node = hitNode;
            }

            // When on a planet, can only focus on anything other then other planets
            else if (selectedNode.NodeType == MenuNodeType.Planet && hitNode.NodeType != MenuNodeType.Pillar && hitNode.NodeType != MenuNodeType.Planet)
            {
                node = hitNode;
            }

            // When on the surface, can only focus on pillar or last planet
            else if (selectedNode.NodeType == MenuNodeType.Surface && (hitNode == lastNode || hitNode.NodeType == MenuNodeType.Pillar))
            {
                node = hitNode;
            }

            // If the node changed
            if (node != null && node != focusedNode && node.NodeType != selectedNode.NodeType)
            {
                // De-select the old one, if one.
                if (focusedNode != null)
                {
                    focusedNode.Focused = false;
                }

                // Change the old one and select it
                focusedNode         = node;
                focusedNode.Focused = true;
            }
        }
        public override void NodeSelected(MenuNode node)
        {
            // selected is galaxy
////			selectedNode = Galaxy.GetComponent<MenuNode>();

            // focused node is planet
            focusedNode = node;

            NodeSelected();
        }
Beispiel #3
0
        public virtual void BackSelected()
        {
            if (previousMenuNode == null)
            {
                return;
            }

            focusedNode = previousMenuNode;
            NodeSelected();
        }
Beispiel #4
0
        private void OnItemGazedOff(object sender, GazeEventArgs eventArguments)
        {
            if (eventArguments.Hit.GetComponent <CurvedUIButton>() != null)
            {
                pillars.UIController.GazedOff(eventArguments.Hit.GetComponent <CurvedUIButton>());
                return;
            }

            // Nothing is looked at.
            if (GazeWatcher.CurrentGazedItems.Count <= 0 && focusedNode != null)
            {
                focusedNode.Focused = false;
                focusedNode         = null;
            }
        }
Beispiel #5
0
        private void Start()
        {
            gazeListener = new GazeListener(new [] { typeof(MenuNode), typeof(ReferenceNode), typeof(CurvedUIButton) },
                                            OnItemGazedAt,
                                            OnItemGazedOff);
            GazeWatcher.AddListener(gazeListener);
            GazeWatcher.RaycastEnabled = true;

            lastNode = selectedNode = Galaxy.GetComponent <MenuNode>();

            SceneManager.sceneLoaded += OnSceneLoadedDoPillarSetup;
            SceneManager.LoadScene("Pillars", LoadSceneMode.Additive);

            if (DeepLinkOnLoad)
            {
                deepLinkDifficulty = DifficultyToLoad;
            }
        }
        private void OnItemGazedAt(object sender, GazeEventArgs eventArguments)
        {
            if (eventArguments.Hit.GetComponent <CurvedUIButton>() != null)
            {
                CurvedUIController.GazedAt(eventArguments.Hit.GetComponent <CurvedUIButton>());
                return;
            }

            MenuNode hitNode = eventArguments.Hit.GetComponent <MenuNode>();

            // Maybe we hit a reference node
            if (hitNode == null)
            {
                ReferenceNode reference = eventArguments.Hit.GetComponent <ReferenceNode>();
                hitNode = (reference != null) ? reference.Node : null;
            }

            // Still nothing
            if (hitNode == null)
            {
                return;
            }

            MenuNode node = null;

            node = hitNode;

            // If the node changed
            if (node != null && node != focusedNode)
            {
                // De-select the old one, if one.
                if (focusedNode != null)
                {
                    focusedNode.Focused = false;
                }

                // Change the old one and select it
                focusedNode         = node;
                focusedNode.Focused = true;
            }
        }
Beispiel #7
0
        private void DelayedDeepLinkOnLoadAction()
        {
            if (Galaxy == null || Holocron == null)
            {
                return;
            }

            // Galaxy
            Galaxy.GetComponent <Animator>().Play("galaxy_hiddenToTertiary");

            // Planet
            GameObject planet;

            if (DeepLinkToBonusPlanet == null)
            {
                planet = Galaxy.transform.Find("Planets/" + DeepLinkToPlanet + "_rotationOffset/planetRot/planet").gameObject;
            }
            else
            {
                planet = Galaxy.transform.Find("Planets/" + DeepLinkToBonusPlanet.Value + "_rotationOffset/planetRot/planet").gameObject;
            }

            PlanetMenuNode planetNode = planet.GetComponent <PlanetMenuNode>();

            if (planetNode == null)
            {
                return;
            }

            planetNode.FacePlayer(stereoCamera.transform);
            selectedNodeParent = planetNode.GetRootTransform().parent;
            planetNode.GetRootTransform().SetParent(Galaxy.transform.parent, true);
            planetNode.Animator.Play("planet_hiddenToSecondary");

            // Pillars
            Animator animator;

            if (!planetNode.IsBonusPlanet)
            {
                animator = pillars.GetPlanetAnimator(planetNode.Planet);
            }
            else
            {
                animator = pillars.GetPlanetAnimator(planetNode.BonusPlanet);
            }
            animator.Play("planetPillars_planetTo" + GetGameName(DeepLinkToGame));
            pillars.FacePlayer(stereoCamera.transform);

            // Holocron
            Holocron.GetComponent <Animator>().Play("ClosedIdle");

            // Setup selected and last selected
            lastNode     = planetNode;
            selectedNode = animator.transform.Find("Pillars_" + GetGameName(DeepLinkToGame)).GetComponentInChildren <SurfaceMenuNode>(true);

            // Ambience
            if (!planetNode.IsBonusPlanet)
            {
                AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + DeepLinkToPlanet + "_Play", selectedNode.gameObject);
            }
            else
            {
                AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + DeepLinkToBonusPlanet.Value + "_Play", selectedNode.gameObject);
            }

            // Find the right pillar and select it
            PillarMenuNode[] pillarNodes = selectedNode.transform.GetComponentsInChildren <PillarMenuNode>(true);

            for (int i = 0; i < pillarNodes.Length; i++)
            {
                if (pillarNodes[i].Config == ConfigToLoad)
                {
                    selectedPillarNode          = pillarNodes[i];
                    selectedPillarNode.Selected = true;
                    selectedPillarNode.AnimatePillar();
                    break;
                }
            }

            // Find next pillar
            if (MenuController.UnlockedPillar)
            {
                for (int i = 0; i < pillarNodes.Length; i++)
                {
                    if (pillarNodes[i].Config.PreviousConfig == selectedPillarNode.Config)
                    {
                        // Turn on the effect
                        if (pillarNodes[i].FirstUnlockEffect != null)
                        {
                            pillarNodes[i].FirstUnlockEffect.SetActive(true);

                            // Play the audio
                            if (pillarNodes[i].Config.Game == Game.Duel)
                            {
                                string audioEvent = AudioEventName.Archivist.GalaxyMap.DuelPillarUnlock[(int)DifficultyToLoad,
                                                                                                        (int)pillarNodes[i].Config.Duelist];

                                if (!string.IsNullOrEmpty(audioEvent))
                                {
                                    AudioEvent.Play(audioEvent, Holocron);
                                }
                            }
                        }

                        break;
                    }
                }

                MenuController.UnlockedPillar = false;
            }

            // Bent Screen
            if (!planetNode.IsBonusPlanet)
            {
                pillars.UIController.Setup(selectedNode as SurfaceMenuNode, planetNode.Planet);
            }
            else
            {
                pillars.UIController.Setup(selectedNode as SurfaceMenuNode, planetNode.BonusPlanet);
            }

            if (selectedPillarNode != null)
            {
                pillars.UIController.Setup(selectedPillarNode, deepLinkDifficulty);
            }

            // Reset
            DeepLinkOnLoad = false;
            ConfigToLoad   = null;
        }
Beispiel #8
0
        /// <summary>
        /// Select the current focused node.
        /// </summary>
        public virtual void NodeSelected()
        {
            // Difficulty Button
            if (pillars != null && pillars.UIController.GazeClick())
            {
                return;
            }

            // Nothing selected, or we are animating, or you selected something in the same view as you're aleady in.
            if (Animating || focusedNode == null || (focusedNode != null && focusedNode.NodeType == selectedNode.NodeType))
            {
                return;
            }

            // Locked Planet
            if (focusedNode is PlanetMenuNode && (focusedNode as PlanetMenuNode).Locked)
            {
                // Locked Planet Audio (4 cases)
                PlanetMenuNode planetNode = focusedNode as PlanetMenuNode;

                bool tdComplete    = ContainerAPI.IsLevelComplete(planetNode.PreviousTDConfig, 1);
                bool chessComplete = ContainerAPI.IsLevelComplete(planetNode.PreviousChessConfig, 1);
                bool playAnimation = true;

                if (tdComplete && chessComplete)
                {
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedBoth, Holocron);
                }
                else if (tdComplete)
                {
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedTowerDefense, Holocron);
                }
                else if (chessComplete)
                {
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedChess, Holocron);
                }
                else
                {
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedGeneral, Holocron);
                    playAnimation = false;
                }

                if (playAnimation)
                {
                    GameObject lockedEffect = (focusedNode as PlanetMenuNode).PreviousPlanetEffect;
                    if (lockedEffect != null)
                    {
                        lockedEffect.SetActive(true);
                    }
                }

                AudioEvent.Play(AudioEventName.GalaxyMap.NodeLocked, gameObject);

                return;
            }

            // Clicked the same pillar twice
            if (selectedPillarNode != null && !selectedPillarNode.Locked && focusedNode == selectedPillarNode)
            {
                DeepLinkOnLoad   = true;
                DifficultyToLoad = pillars.UIController.CurrentDifficulty;
                GetComponent <Animator>().Play("menuFull_hide");
                AudioEvent.Play(AudioEventName.GalaxyMap.LaunchActivity, gameObject);
                StartCoroutine(LaunchGame());
                return;
            }

            if (selectedPillarNode != null)
            {
                selectedPillarNode.Selected = false;
                selectedPillarNode          = null;
            }

            // Pillar Selected, show the screen.
            if (focusedNode.NodeType == MenuNodeType.Pillar)
            {
                selectedPillarNode          = (PillarMenuNode)focusedNode;
                selectedPillarNode.Selected = true;

                pillars.UIController.Setup(selectedPillarNode);

                selectedPillarNode.AnimatePillar();

                AudioEvent.Play(AudioEventName.GalaxyMap.BeginActivity, gameObject);

                return;
            }

            if (focusedNode != null && focusedNode is PorgMenuNode)
            {
                focusedNode.Selected = true;

                return;
            }

            // Animating and set the new current view
            Animating = true;

            // Last and Current Nodes
            lastNode       = selectedNode;
            lastNodeParent = selectedNodeParent;

            selectedNode         = focusedNode;
            selectedNode.Focused = false;
            focusedNode          = null;

            // Selected
            lastNode.Selected     = false;
            selectedNode.Selected = true;

            // Galaxy to Planet
            if (selectedNode.NodeType == MenuNodeType.Planet && lastNode.NodeType == MenuNodeType.Galaxy)
            {
                PlanetMenuNode currentPlanetNode = ((PlanetMenuNode)selectedNode);
                previousMenuNode = lastNode;
                if (currentPlanetNode.IsBonusPlanet)
                {
                    DeepLinkToBonusPlanet = currentPlanetNode.BonusPlanet;
                }
                else
                {
                    DeepLinkToPlanet      = currentPlanetNode.Planet;
                    DeepLinkToBonusPlanet = null;
                }

                // Break Planet Out
                selectedNodeParent = selectedNode.GetRootTransform().parent;
                selectedNode.GetRootTransform().SetParent(Galaxy.transform.parent, true);

                // Animate Planet
                selectedNode.Animator.Play("planet_restToPrimary");
                ((PlanetMenuNode)selectedNode).SurfaceAnimator.Play("planetSurface_show");
                ((PlanetMenuNode)selectedNode).FacePlayer(stereoCamera.transform);

                // Face player
                pillars.FacePlayer(stereoCamera.transform);

                // Animate Galaxy
                lastNode.OnAnimationComplete += AnimationComplete;
                lastNode.Animator.Play("galaxy_primaryToSecondary");

                // Animate New Pillars
                if (!currentPlanetNode.IsBonusPlanet)
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).Planet).Play("planetPillars_hiddenToPlanet");
                }
                else
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).BonusPlanet).Play("planetPillars_hiddenToPlanet");
                }

                // Show 3rd Pillar Pin if needed
                pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).Planet);
            }

            // Planet to Galaxy
            else if (selectedNode.NodeType == MenuNodeType.Galaxy && lastNode.NodeType == MenuNodeType.Planet)
            {
                PlanetMenuNode lastPlanet = (PlanetMenuNode)lastNode;

                // Animate Galaxy
                previousMenuNode = null;
                selectedNode.Animator.Play("galaxy_secondaryToPrimary");

                // Animate Planet
                //disabling to potentially fix DCM-1751
                //NavigationController.IsWaitingForAnimationToComplete = true;
                lastNode.OnAnimationComplete += AnimationComplete;
                lastNode.Animator.Play("planet_primaryToRest");
                ((PlanetMenuNode)lastNode).SurfaceAnimator.Play("planetSurface_hide");

                // Animate New Pillars
                if (!lastPlanet.IsBonusPlanet)
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).Planet).Play("planetPillars_planetToHidden");

                    // Hide 3rd Pillar Pin if needed
                    pillars.CheckToHideSecondLevelPin(((PlanetMenuNode)lastNode).Planet);
                }
                else
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).BonusPlanet).Play("planetPillars_planetToHidden");
                    // Hide 3rd Pillar Pin if needed
                    //pillars.CheckToHideSecondLevelPin(((PlanetMenuNode)lastNode).BonusPlanet);
                }
            }

            // Planet to Surface
            else if (selectedNode.NodeType == MenuNodeType.Surface && lastNode.NodeType == MenuNodeType.Planet)
            {
                PlanetMenuNode lastPlanetNode = (PlanetMenuNode)lastNode;

                previousMenuNode = lastNode;
                DeepLinkToGame   = ((SurfaceMenuNode)selectedNode).LaunchGame;

                if (!lastPlanetNode.IsBonusPlanet)
                {
                    pillars.UIController.Setup((SurfaceMenuNode)selectedNode, ((PlanetMenuNode)lastNode).Planet);
                }
                else
                {
                    pillars.UIController.Setup((SurfaceMenuNode)selectedNode, ((PlanetMenuNode)lastNode).BonusPlanet);
                }

                Galaxy.GetComponent <Animator>().Play("galaxy_secondaryToTertiary");

                if (!lastPlanetNode.IsBonusPlanet)
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).Planet).Play("planetPillars_planetTo" + GetGameName(((SurfaceMenuNode)selectedNode).LaunchGame));
                }
                else
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).BonusPlanet).Play("planetPillars_planetTo" + GetGameName(((SurfaceMenuNode)selectedNode).LaunchGame));
                }

                lastNode.OnAnimationComplete += AnimationComplete;
                lastNode.Animator.Play("planet_primaryToSecondary");
                ((PlanetMenuNode)lastNode).SurfaceAnimator.Play("planetSurface_hide");

                AudioEvent.Play(AudioEventName.GalaxyMap.SelectActivity, gameObject);

                // Play the ambience for the planet surface
                if (!lastPlanetNode.IsBonusPlanet)
                {
                    AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)lastNode).Planet + "_Play",
                                    selectedNode.gameObject);
                }
                // Play the ambience for bonus planet
                else
                {
                    AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)lastNode).BonusPlanet + "_Play", selectedNode.gameObject);

                    // checking for assault mode completion on easy
                    if (ConfigToLoad != null && ContainerAPI.IsLevelComplete(ConfigToLoad, 1))
                    {
                        AudioEvent.PlayOnceEver("MAP_DX_Arch_Crait_000_004", selectedNode.gameObject);
                    }
                }
            }

            // Surface to Planet
            else if (selectedNode.NodeType == MenuNodeType.Planet && lastNode.NodeType == MenuNodeType.Surface)
            {
                PlanetMenuNode selectedPlanet = (PlanetMenuNode)selectedNode;

                previousMenuNode = Galaxy.GetComponent <MenuNode>();
                pillars.UIController.Hide();

                // Hide Lock Icons
                PillarMenuNode[] pillarNodes = lastNode.gameObject.GetComponentsInChildren <PillarMenuNode>();

                for (int i = 0; i < pillarNodes.Length; i++)
                {
                    pillarNodes[i].LockObject.SetActive(false);
                }

                Galaxy.GetComponent <Animator>().Play("galaxy_tertiaryToSecondary");

                if (!selectedPlanet.IsBonusPlanet)
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).Planet).Play("planetPillars_" + GetGameName(((SurfaceMenuNode)lastNode).LaunchGame).ToLower() + "ToPlanet");
                }
                else
                {
                    pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).BonusPlanet).Play("planetPillars_" + GetGameName(((SurfaceMenuNode)lastNode).LaunchGame).ToLower() + "ToPlanet");
                }

                selectedNode.OnAnimationComplete += AnimationComplete;
                selectedNode.Animator.Play("planet_secondaryToPrimary");
                ((PlanetMenuNode)selectedNode).SurfaceAnimator.Play("planetSurface_show");
                ((PlanetMenuNode)selectedNode).FacePlayer(stereoCamera.transform);

                // Show 3rd Pillar Pin if needed
                if (!selectedPlanet.IsBonusPlanet)
                {
                    pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).Planet);
                }
                else
                {
                    pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).BonusPlanet);
                }

                AudioEvent.Play(AudioEventName.GalaxyMap.SelectBack, gameObject);

                // Stop the ambience for the planet surface
                if (!selectedPlanet.IsBonusPlanet)
                {
                    AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)selectedNode).Planet + "_Stop",
                                    lastNode.gameObject);
                }
                else
                {
                    AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)selectedNode).BonusPlanet + "_Stop",
                                    lastNode.gameObject);
                }
            }
        }