Пример #1
0
        public static void CreateToggleExitDoorButton(IntentionGrid grid, Random random)
        {
            //get a humble GroundLevel Tile
            var tiles           = grid.GetByMeaning(Meaning.GroundLevel).Where(t => grid.Positions[t.X, t.Y].Intentions.Count == 1).ToList();
            var tile            = tiles[random.Next(0, tiles.Count())];
            var buttonIntention = Intention.ButtonIntention();
            var exit            = grid.GetByMeaning(Meaning.ExitPath).Where(t => grid.Positions[t.X, t.Y].Intentions.Any(i => i.Meaning == Meaning.ToggleDoor)).First().Intentions.Where(i => i.Meaning == Meaning.ToggleDoor).First();

            buttonIntention.RelatedTileMeaning = exit;
            exit.RelatedTileMeaning            = buttonIntention;
            grid.Positions[tile.X, tile.Y].Intentions.Add(Intention.ButtonIntention());

            DebugPrintMeaning(grid, Meaning.Button);
        }
Пример #2
0
        public static void CreateHorizontalExitPath(IntentionGrid grid, int exitX, int exitY)
        {
            var circuits  = grid.GetByMeaning(Meaning.Circuit);
            var leftMost  = circuits.Select(x => x.X).Min();
            var rightMost = circuits.Select(x => x.X).Max();

            var xDir   = 0;
            var xStart = 0;
            var xStop  = leftMost;

            if (exitX <= 0)
            {
                xDir = 1;
            }
            else
            {
                xDir   = -1;
                xStart = grid.Width - 1;
                xStop  = rightMost;
            }

            for (var x = xStart; x != xStop; x += xDir)
            {
                grid.Positions[x, exitY].Intentions.Add(Intention.ExitPathIntention());
            }

            DebugPrintMeaning(grid, Meaning.ExitPath);
        }
Пример #3
0
        public static void CreateToggleExitDoor(IntentionGrid grid)
        {
            var tile = grid.GetByMeaning(Meaning.ExitPath).Where(t => t.X == grid.Width - 1 || t.X == 0).FirstOrDefault();

            grid.Positions[tile.X, tile.Y].Intentions.Add(Intention.ToggleDoorIntention());

            DebugPrintMeaning(grid, Meaning.ToggleDoor);
        }
Пример #4
0
        public static void CreateRopeSection(IntentionGrid grid, Random random)
        {
            //TODO - RANDOMIZE THIS

            //get a humble groundlevel tile
            var tiles = grid.GetByMeaning(Meaning.GroundLevel).Where(t => grid.Positions[t.X, t.Y].Intentions.Count == 1).ToList();

            //find 3 in a row
            var middle = tiles.Where(t => tiles.Any(tleft => tleft.Y == t.Y && tleft.X == t.X - 1) && tiles.Any(tright => tright.Y == t.Y && tright.X == t.X + 1)).FirstOrDefault();

            if (middle != null)
            {
                /*for(var x = middle.X -1; x <= middle.X +1; x++)
                 * {
                 *  grid.Positions[x, middle.Y].Intentions.Add(Intention.RopeIntention());
                 * }*/
                grid.Positions[middle.X, middle.Y].Intentions.Add(Intention.RopeIntention());
            }

            DebugPrintMeaning(grid, Meaning.Rope);
        }