Beispiel #1
0
        // true если словарь содержит все нужные тайлы перехода на определенный тип
        // Нужные:
        //Up, Down,
        //Left, Right,
        //DownRight, UpRight, UpLeft, DownLeft,
        //AntiDownRight, AntiUpRight, AntiUpLeft, AntiDownLeft,
        bool it_valid_crossing(AutoTileDict dict, TileType another)
        {
            bool valid = true;

            if (dict.GetCountTiles(another, "Up", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "Down", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "Left", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "Right", 0) == 0)
            {
                valid = false;
            }

            if (dict.GetCountTiles(another, "DownRight", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "UpRight", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "UpLeft", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "DownLeft", 0) == 0)
            {
                valid = false;
            }

            if (dict.GetCountTiles(another, "AntiDownRight", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "AntiUpRight", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "AntiUpLeft", 0) == 0)
            {
                valid = false;
            }
            if (dict.GetCountTiles(another, "AntiDownLeft", 0) == 0)
            {
                valid = false;
            }

            return(valid);
        }
Beispiel #2
0
        public void UpdateAutoTileForm(bool lu, bool ru, bool ld, bool rd)
        {
            autotile_args.boolMask[0, 0] = lu;
            autotile_args.boolMask[1, 0] = ru;
            autotile_args.boolMask[0, 1] = ld;
            autotile_args.boolMask[1, 1] = rd;

            autotile_args.form = AutoTileDict.BoolMask2String(autotile_args.boolMask);
        }
Beispiel #3
0
        // составляет список с "правильными" переходами указанного словаря.
        List <TileType> get_all_valid_tiletypes_path_from_dict(AutoTileDict dict)
        {
            List <TileType> valids = new List <TileType>();

            foreach (TileType tt in dict.Friends.Keys)
            {
                if (it_valid_crossing(dict, tt))
                {
                    valids.Add(tt);
                }
            }
            return(valids);
        }
Beispiel #4
0
        /// пытается найти тайл по указанной маске и типам. (а также и варианту)
        public Tile GetAutoTileByMask(TileType type, TileType another, bool[,] boolmask, int variant, int seed)
        {
            string form = AutoTileDict.BoolMask2String(boolmask);

            int      var      = variant;
            TileType tmp_type = type;

            // если нет ни одного миниквадрата основной формы, то тупо заменяем основную форму на вторичную.
            if (!boolmask[0, 0] && !boolmask[0, 1] && !boolmask[1, 0] && !boolmask[1, 1])
            {
                tmp_type = another;
                form     = "Center";
            }

            // Только центральные тайлы имеют вариант.
            if (form != "Center")
            {
                var = 0;
            }

            Tile tmp = autoTile_dict[tmp_type].GetRandomTile(another, form, var, seed);

            return(tmp);
        }