Exemplo n.º 1
0
        private void MakeNewMap()
        {
            CurrentLevel = new Guardian_Roguelike.World.Map();
            Utilities.InterStateResources.Instance.Resources["Game_CurrentLevel"] = CurrentLevel;
            MapCons.Clear();
            CurrentLevel.Creatures.Add(Player);
            Player.Level = CurrentLevel;
            CurrentLevel.DestroyTile(Player.Position);
            LevelNumber++;

            //Place a dwarf randomly
            Random RandGen = new Random();

            while (true)
            {
                int dx = RandGen.Next(0, 90);
                int dy = RandGen.Next(0, 30);

                if (CurrentLevel.CheckWalkable(dx, dy))
                {
                    World.Creatures.GiantRat Olon = new World.Creatures.GiantRat();
                    Olon.Generate();
                    Olon.Position = new System.Drawing.Point(dx, dy);
                    Olon.MyAI     = new AI.FSM_Aggressive(Olon);
                    CurrentLevel.Creatures.Add(Olon);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void RenderToConsole(libtcodWrapper.Console Target)
        {
            Target.Clear();
            for (int x = 0; x < WIDTH; x++)
            {
                for (int y = 0; y < HEIGHT; y++)
                {
                    if (DisplayData[x, y].HasBeenSeen || DisplayData[x, y].Type == TerrainTypes.ExitPortal) //Last condition for debug only
                    {
                        if (DisplayData[x, y].IsVisible)
                        {
                            Target.ForegroundColor = DisplayData[x, y].DrawColor;
                        }
                        else
                        {
                            Target.ForegroundColor = libtcodWrapper.ColorPresets.Gray;
                        }
                        Target.PutChar(x, y, DisplayData[x, y].CharRepresentation);
                    }
                }
            }

            for (int i = Creatures.Count - 1; i >= 0; i--)
            {
                World.Creatures.CreatureBase C = Creatures[i];
                if (DisplayData[C.Position.X, C.Position.Y].IsVisible)
                {
                    Target.ForegroundColor = C.DrawColor;
                    Target.PutChar(C.Position.X, C.Position.Y, C.CharRepresentation);
                }
            }
        }
Exemplo n.º 3
0
        public static void RenderRecentToConsole(libtcodWrapper.Console Target)
        {
            Target.Clear();

            for (int i = (Lines.Count - 4 > 0 ? Lines.Count - 4 : 0), j = 0; i < Lines.Count; i++, j++)
            {
                Target.ForegroundColor = Lines[i].TextColor;
                Target.PrintLine(Lines[i].Text + "\n", 0, j, libtcodWrapper.LineAlignment.Left);
            }
        }
Exemplo n.º 4
0
        private void Render()
        {
            Root.Clear();
            Utilities.MessageLog.RenderRecentToConsole(MsgCons);
            MsgCons.Blit(0, 0, 90, 5, Root, 0, 0);

            CurrentLevel.RenderToConsole(MapCons);

            MapCons.Blit(0, 0, 90, 30, Root, 1, 5);

            StatusCons.Clear();
            StatusCons.PrintLine("Turn: " + TurnsPassed.ToString(), 0, 0, libtcodWrapper.LineAlignment.Left);
            StatusCons.PrintLine("Level " + LevelNumber.ToString(), 0, 1, libtcodWrapper.LineAlignment.Left);
            StatusCons.PrintLine("V:" + Player.BaseVigor.ToString() + " E:" + Player.BaseEnergy.ToString() + " Sp:" + Player.BaseSpeed.ToString() + " St:" + Player.BaseStrength.ToString() + " A:" + Player.BaseAim.ToString(), 0, 2, libtcodWrapper.LineAlignment.Left);

            StatusCons.PrintLine(MakeLimbStatusString(Player), 0, 3, libtcodWrapper.LineAlignment.Left);
            StatusCons.Blit(0, 0, 90, 5, Root, 0, 35);

            Root.Flush();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Renders the full message log to a console.
        /// </summary>
        /// <param name="Target">Target console.</param>
        /// <param name="Scroll">How much to scroll down.</param>
        /// <returns>Which way can be scrolled.</returns>
        public static MessageLogScrollPossibilities RenderFullToConsole(libtcodWrapper.Console Target, int Scroll)
        {
            Target.Clear();

            bool canscrollup, canscrolldown;

            canscrollup = canscrolldown = false;
            if (Scroll > 0)
            {
                canscrollup = true;
            }
            for (int i = Scroll, j = 0; i < Lines.Count; i++, j++)
            {
                Target.ForegroundColor = Lines[i].TextColor;
                Target.PrintLine(Lines[i].Text, 0, j, libtcodWrapper.LineAlignment.Left);
                if (j > 30)
                {
                    canscrolldown = true;
                    break;
                }
            }
            if (canscrolldown && canscrollup)
            {
                return(MessageLogScrollPossibilities.Both);
            }
            else if (canscrolldown)
            {
                return(MessageLogScrollPossibilities.Down);
            }
            else if (canscrollup)
            {
                return(MessageLogScrollPossibilities.Up);
            }
            else
            {
                return(MessageLogScrollPossibilities.None);
            }
        }