Esempio n. 1
0
        private void NextCondition()
        {
            Model.CurrentCondition.StopCondition();

            Model.CurrentConditionIndex++;
            Model.CurrentQuestionIndex = -1;

            if (Model.CurrentConditionIndex >= _conditionModelTemplates.Count)
            {
                //end study
                Model.EnableStudy           = false;
                Model.CurrentConditionIndex = -1;
            }
            else
            {
                ConditionFactory.BuildCondition(_conditionModelTemplates[Model.CurrentConditionIndex], Model.CurrentCondition, Model);
                Model.CurrentConditionQuestionIndices = GetCurrentQuestionIndices();

                AppController.AppModel.OptimizationModel.AutoOptimizeEnabled = false;
                AppController.AppModel.EnableAutoPlacement = false;
                AppController.ResetSolution();
                AppController.UpdateModelForTask(Model.CurrentCondition.SecondayTask);

                if (!Model.EnableBreak)
                {
                    StartNextCondition();
                }
                else
                {
                    StartNextConditionDelayed();
                }
            }
        }
Esempio n. 2
0
 public TestLevel(int width, int height) : base(
         new LevelLayout(width, height,
                         new List <BlockingTileSpawnInfo>()
 {
     new BlockingTileSpawnInfo() { GridPosition = Vector2Int.one, Health = 50f },
     new BlockingTileSpawnInfo() { GridPosition = new Vector2Int(1, 2), Health = 50f },
     new BlockingTileSpawnInfo() { GridPosition = new Vector2Int(2, 2), Health = 50f },
     new BlockingTileSpawnInfo() { GridPosition = new Vector2Int(3, 4), Health = 50f },
     new BlockingTileSpawnInfo() { GridPosition = new Vector2Int(3, 3), Health = 50f }
 },
                         new List <MoveableTileSpawnInfo>()
 {
     new MoveableTileSpawnInfo() { GridPosition = Vector2Int.zero, Value = 2 },
     new MoveableTileSpawnInfo() { GridPosition = Vector2Int.up, Value = 2 },
     new MoveableTileSpawnInfo() { GridPosition = Vector2Int.right, Value = 1 },
     new MoveableTileSpawnInfo() { GridPosition = new Vector2Int(3, 2), Value = 2 },
     new MoveableTileSpawnInfo() { GridPosition = new Vector2Int(4, 4), Value = 3 },
     new MoveableTileSpawnInfo() { GridPosition = new Vector2Int(2, 4), Value = 0 }
 }),
         new DefaultValueAndColorGenerator(new ColorPickerValueAsIndex(new Color[] { Color.red, Color.green, Color.blue, Color.yellow }), new DirectionMapping(-2, 1, 2, -1)),
         ConditionFactory.BuildCondition(typeof(NumberOfMoveableTilesLeftWinCondition), $"{typeof(NumberOfMoveableTilesLeftWinCondition)}\n1"),
         new NumberOfMovesLoseCondition(5),
         new DifferenceOfNMergeRule(1),
         new SpawnBlockerMergeEffect())
 {
 }
Esempio n. 3
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));
    }
Esempio n. 4
0
 public void SetLoseCondition(string data)
 {
     loseCondition = ConditionFactory.BuildCondition(data);
 }
Esempio n. 5
0
 public void SetWinCondition(string data)
 {
     winCondition = ConditionFactory.BuildCondition(data);
 }