Exemplo n.º 1
0
    public static Level Deserialize(string str)
    {
        string[] split = str.Split(dataSeperator.ToCharArray());

        if (split.Length < 6)
        {
            throw new Exception($"Can't build level from this data: {str}");
        }

        LevelLayout layout             = LevelLayout.Deserialize(split[0]);
        BaseValueAndColorGenerator gen = ValueAndColorGeneratorFactory.BuildValueAndColorGenerator(split[1]);

        Condition winCond = ConditionFactory.BuildCondition(split[2]);

        Condition loseCond = ConditionFactory.BuildCondition(split[3]);

        BaseMergeRule mergeRule = MergeRuleFactory.BuildMergeRule(split[4]);

        BaseMergeEffect effect = MergeEffectFactory.BuildMergeEffect(split[5]);

        return(new Level(layout, gen, winCond, loseCond, mergeRule, effect));
    }
Exemplo n.º 2
0
 public void SetMergeEffect(string data)
 {
     mergeEffect = MergeEffectFactory.BuildMergeEffect(data);
 }