예제 #1
0
        private static void DrawMap()
        {
            FoV.RayCast();

            for (int x = Rogue.GameWorld.Player.CameraX - 1; x < Constants.CameraWidth + Rogue.GameWorld.Player.CameraX + 1 + 1; x++)
            {
                for (int y = Rogue.GameWorld.Player.CameraY - 1; y < Constants.CameraHeight + Rogue.GameWorld.Player.CameraY + 1 + 1; y++)
                {
                    if (FoV.InFov(Rogue.GameWorld.Player.X, Rogue.GameWorld.Player.Y, x, y, Rogue.GameWorld.Player))
                    {
                        if (GameMap.IsTerrain(x, y, Constants.Terrain.TileWall))
                        {
                            DrawMapTile(x, y, Tiles.Terrain.WallTile, "white");
                        }
                        else if (GameMap.IsTerrain(x, y, Constants.Terrain.TileFloor))
                        {
                            DrawMapTile(x, y, Tiles.Terrain.FloorTile, "white");
                        }
                    }
                    else if (GameMap.MapExplored(x, y))
                    {
                        if (GameMap.IsTerrain(x, y, Constants.Terrain.TileWall))
                        {
                            DrawMapTile(x, y, Tiles.Terrain.WallTile, "grey");
                        }
                        else if (GameMap.IsTerrain(x, y, Constants.Terrain.TileFloor))
                        {
                            DrawMapTile(x, y, Tiles.Terrain.FloorTile, "grey");
                        }
                    }
                }
            }
        }
예제 #2
0
        private static void MouseHoverLook()
        {
            Terminal.Color(Terminal.ColorFromName("white"));

            Terminal.Layer(Constants.Layers["Messages"]);

            int mouseX = Terminal.State(Terminal.TK_MOUSE_X) - 1;
            int mouseY = Terminal.State(Terminal.TK_MOUSE_Y) - 1;

            if (mouseX >= 0 && mouseY >= 0 && mouseX <= 60 && mouseY <= 34)
            {
                if (mouseX % 2 != 0)
                {
                    mouseX -= 1;
                }

                if (mouseY % 2 != 0)
                {
                    mouseY -= 1;
                }

                Coordinate coord = Camera.CameraToCoordinate(mouseX / 4, mouseY / 4);

                foreach (GameObject obj in Rogue.GameWorld.Objects)
                {
                    if (obj.X == coord.X && obj.Y == coord.Y)
                    {
                        if ((GameMap.MapExplored(obj.X, obj.Y) && obj.AlwaysVisible) || FoV.InFov(Rogue.GameWorld.Player.X, Rogue.GameWorld.Player.Y, obj.X, obj.Y, Rogue.GameWorld.Player))
                        {
                            Terminal.Print(mouseX + 1, mouseY + 1, obj.Name);
                        }
                    }
                }
            }
        }
        private static void ThrowingAnimation(GameObject obj, GameObject user)
        {
            for (int times = 0; times < Constants.SpellRange; times++)
            {
                if (user.Fighter.Direction == 90 || user.Fighter.Direction == 270)
                {
                    int dx = user.Fighter.Direction == 90 ? -1 : 1;

                    if (GameMap.MapBlocked(obj.X + dx, obj.Y))
                    {
                        break;
                    }
                    if (CommonMethods.TargetInCoordinate(obj.X, obj.Y))
                    {
                        break;
                    }

                    for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++)
                    {
                        Rendering.RenderAll(obj);
                        obj.OffsetX += Constants.MoveSmoothSteps * dx;

                        if (GameMap.MapExplored(obj.X + dx, obj.Y) || FoV.InFov(user.X, user.Y, obj.X + dx, obj.Y, user))
                        {
                            obj.Draw("white", true);
                        }

                        Terminal.Refresh();
                    }

                    obj.X      += dx;
                    obj.OffsetX = 0;
                }
                else if (user.Fighter.Direction == 0 || user.Fighter.Direction == 180)
                {
                    int dy = user.Fighter.Direction == 0 ? -1 : 1;

                    if (GameMap.MapBlocked(obj.X, obj.Y + dy))
                    {
                        break;
                    }
                    if (CommonMethods.TargetInCoordinate(obj.X, obj.Y))
                    {
                        break;
                    }

                    for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++)
                    {
                        Rendering.RenderAll(obj);
                        obj.OffsetY += Constants.MoveSmoothSteps * dy;

                        if (GameMap.MapExplored(obj.X, obj.Y + dy) || FoV.InFov(user.X, user.Y, obj.X, obj.Y + dy, user))
                        {
                            obj.Draw("white", true);
                        }

                        Terminal.Refresh();
                    }

                    obj.Y      += dy;
                    obj.OffsetY = 0;
                }
            }
        }