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); }
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(); }
/// <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)); } }