예제 #1
0
        private void UpdateWorldMapHUD(GraphNode targetNode, PlayerProgress playerProgress)
        {
            // Update worldmap HUD
            LevelNode     ln        = targetNode as LevelNode;
            WorldNode     wn        = targetNode as WorldNode;
            LevelProgress progress  = null;
            LevelData     levelData = null;

            // Check what is the new node.
            string whatIsIt = "";

            if (ln)
            {
                levelData = ln.data;

                if (levelData.isSecretLevel)
                {
                    whatIsIt = "Secret level";
                }
                else
                {
                    whatIsIt = "Level " + (ln.worldIndex + 1) + "-" + (ln.levelIndex + 1);
                }

                // Try to get progress.
                playerProgress.worldProgress[ln.worldIndex].finishedLevels.TryGetValue(ln.levelIndex, out progress);
            }
            else if (wn)
            {
                whatIsIt = "Go to " + wn.worldDataTarget.worldname;
            }

            hudMgr.UpdateLevelPreview(whatIsIt, levelData, progress);
        }
예제 #2
0
        private IEnumerator SwitchToNewWorld(WorldNode worldNode)
        {
            GameManager.instance.TriggerFadeIn();

            yield return(new WaitForSeconds(1.0f));

            // Notify gamemanager.
            GameManager.instance.MoveToNewWorld(worldNode.worldIndex, worldNode.targetNodeIndex);

            yield return(new WaitForEndOfFrame());

            GameManager.instance.TriggerFadeOut();
        }
예제 #3
0
        /// <summary>
        /// Interact with the current node where Boing is.
        /// </summary>
        /// <param name="playerProgress">Informations about the player.</param>
        public void InteractWithCurrentNode(PlayerProgress playerProgress)
        {
            GraphNode node = graph.Find(x => x.nodeIndex == playerProgress.currentNodeIndex);

            LevelNode ln = node as LevelNode;
            WorldNode wn = node as WorldNode;

            if (ln)
            {
                SwitchToNewLevel(ln);
            }
            else if (wn)
            {
                StartCoroutine(SwitchToNewWorld(wn));
            }
        }