Exemplo n.º 1
0
        public static void CreateToggleExitDoorButton(IntentionGrid grid, Random random)
        {
            //get a humble GroundLevel Tile
            var tile            = grid.GetByMeaning(Meaning.GroundLevel).Where(t => grid.Positions[t.X, t.Y].Intentions.Count == 1).GetRandomOrDefault(random);
            var buttonIntention = Intention.ButtonIntention();

            buttonIntention.Info = "toggle";
            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);
        }