Ejemplo n.º 1
0
    public MadLevelIcon GetPreviousIcon(MadLevelIcon icon)
    {
        var nextLevel = configuration.FindPreviousLevel(icon.level.name);

        if (nextLevel == null)
        {
            return(null);
        }

        return(GetIcon(nextLevel.name));
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Looks at level.
    /// </summary>
    /// <param name="levelName">Level name.</param>
    public void LookAtLevel(string levelName)
    {
        var level = MadLevel.activeConfiguration.FindLevelByName(levelName);

        if (level.type == MadLevel.Type.Other)
        {
            Debug.LogWarning("Level " + levelName + " is of wrong type. Won't look at it.");
        }
        else if (level.type == MadLevel.Type.Extra)
        {
            level = configuration.FindPreviousLevel(MadLevel.lastPlayedLevelName, MadLevel.Type.Level);
            if (level == null)
            {
                Debug.LogError("Cannot find previous level icon.");
                return; // cannot find previous level of type level
            }
        }

        var icon = GetIcon(levelName);

        if (icon != null)
        {
            LookAtIcon(icon);
        }
        else
        {
            Debug.LogError("Cannot find icon for level: " + levelName);
        }
    }