Example #1
0
    public void InitFromFile(SerializedLevel level)
    {
        Serialized = level;

        Cells.Clear();

        Width  = level.Width;
        Height = level.Height;

        CurrentMinY = 0;
        CurrentMaxY = Height;

        Random.seed = level.Seed;

        Debug.Log("Add cells");
        foreach (var newCell in level.SpecialCells)
        {
            AddCell(newCell.x, newCell.y, newCell.Copy);
        }
        TilesFactory.Instance.NumberOfColors = level.NumberOfColors;

        Gamefield.GetComponent <Gamefield>().GameMode = GameModeFactory.CreateGameMode(level.GameMode);
        Gamefield.GetComponent <Gamefield>().GameMode.Init(Gamefield.GetComponent <Gamefield>());

        InitRandom();
    }
Example #2
0
    public void Init(int levelIndex)
    {
        Index = levelIndex;
        info  = Player.Instance.Info(Index);
        level = MainMenu.Instance.LoadedLevels.First(x => x.Name == (Index + 1).ToString(CultureInfo.InvariantCulture));

        LevelNumberTitle.text = LocalizationStrings.GetString(LevelNumberString, info.Number);
        BestScoreLabel.text   = LocalizationStrings.GetString(BestScoreString, info.BestScore);


        TaskLabel.text = LocalizationStrings.GetString(TaskString, GameModeToString.GetString(GameModeFactory.CreateGameMode(level.GameMode)));
    }