Exemple #1
0
        public static void CreateHorizontalEntrancePath(IntentionDependencies p)
        {
            var circuits  = p.grid.GetByMeaning(Meaning.Circuit);
            var leftMost  = circuits.Select(x => x.X).Min();
            var rightMost = circuits.Select(x => x.X).Max();

            foreach (var entrance in p.entrances.Where(e => e.X == 0 || e.X == p.grid.Width))
            {
            }
            var xDir   = 0;
            var xStart = 0;
            var xStop  = leftMost;

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

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

            //Debug
            DebugPrintMeaning(grid, Meaning.EntrancePath);
        }
Exemple #2
0
        public static int[] CreateGroundLevels(IntentionDependencies p)
        {
            var floorHeight  = 2.0;
            var groundLevels = new int[(int)Math.Floor((p.grid.Height - 2) / floorHeight)];

            for (var i = 0; i < groundLevels.Count(); i++)
            {
                groundLevels[i]  = (int)Math.Floor((i) * (p.grid.Height - 2) / (float)groundLevels.Count());
                groundLevels[i] += (int)floorHeight;
            }

            for (var x = 1; x < p.grid.Width - 1; x++)
            {
                for (var y = 0; y < p.grid.Height; y++)
                {
                    if (groundLevels.Any(gl => gl == y))
                    {
                        p.grid.Positions[x, y].Intentions.Add(Intention.GroundLevelIntention());
                    }
                }
            }

            DebugPrintMeaning(p.grid, Meaning.GroundLevel);

            return(groundLevels);
        }
Exemple #3
0
        public static void CreateCircuit(IntentionDependencies p)
        {
            var verticals = new int[2];

            verticals[0] = (int)Math.Floor(p.grid.Width / 4.0f);
            verticals[1] = (int)Math.Floor(3.0f * p.grid.Width / 4.0f);

            var groundLevels    = p.grid.GetByMeaning(Meaning.GroundLevel);
            var groundLevelsMin = groundLevels.Min(x => x.Y);
            var groundLevelsMax = groundLevels.Max(x => x.Y);

            for (var x = 0; x < p.grid.Width; x++)
            {
                for (var y = 0; y < p.grid.Height; y++)
                {
                    if (
                        !(
                            y >= groundLevelsMin &&
                            y <= groundLevelsMax &&
                            x >= verticals[0] &&
                            x <= verticals[1]
                            )
                        )
                    {
                        continue;
                    }

                    if (
                        (y == groundLevelsMin || y == groundLevelsMax) ||
                        (x == verticals[0] || x == verticals[1])
                        )
                    {
                        p.grid.Positions[x, y].Intentions.Add(Intention.CircuitIntention());
                    }

                    if (x == verticals[0] || x == verticals[1])
                    {
                        p.grid.Positions[x, y].Intentions.Add(Intention.LadderIntention());
                    }
                }
            }


            //Debug
            DebugPrintMeaning(p.grid, Meaning.Circuit);
        }