예제 #1
0
    private void DrawMonsters()
    {
        var halfWidth  = VirtualConsole.instance.width / 2;
        var halfHeight = ((VirtualConsole.instance.height - 15) / 2) + 15;

        for (int x = posX - halfWidth; x < posX + halfWidth; x++)
        {
            for (int y = posY - halfHeight; y < posY + halfHeight; y++)
            {
                if (Visible(x, y) && GetProjectiles(x, y) != "")
                {
                    continue;
                }
                if (GetMonsters(x, y) == "")
                {
                    continue;
                }
                DisplayCharacter dc = null;
                if (x >= 0 && y >= 0 && x < MapFloor.xSize && y < MapFloor.ySize)
                {
                    dc = currentFloor.monsters[x, y].display;
                }
                if (dc != null && Visible(x, y))
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, dc.character, dc.color.r, dc.color.g, dc.color.b, dc.bgColor.r, dc.bgColor.g, dc.bgColor.b);
                }
            }
        }
    }
예제 #2
0
        public void Decimal_NegativeZeroAndTwoFractionals()
        {
            var frame = CreateFrameDecimal(-0.23m);

            AssertFrame(false, false, true,
                        DisplayCharacter.FromDigit(0, true),
                        DisplayCharacter.FromDigit(2),
                        DisplayCharacter.FromDigit(3),
                        frame);
        }
예제 #3
0
        public void Decimal_NegativeZeroAndOneFractional()
        {
            var frame = CreateFrameDecimal(-0.2m);

            AssertFrame(false, false, false,
                        DisplayCharacter.FromSymbol('-'),
                        DisplayCharacter.FromDigit(0, true),
                        DisplayCharacter.FromDigit(2),
                        frame);
        }
예제 #4
0
        public void Decimal_NegativeThreeIntegral()
        {
            var frame = CreateFrameDecimal(-123m);

            AssertFrame(false, false, true,
                        DisplayCharacter.FromDigit(1),
                        DisplayCharacter.FromDigit(2),
                        DisplayCharacter.FromDigit(3),
                        frame);
        }
예제 #5
0
        public void Decimal_NegativeTwoIntegralZeroFractionals()
        {
            var frame = CreateFrameDecimal(-12m);

            AssertFrame(false, false, false,
                        DisplayCharacter.FromSymbol('-'),
                        DisplayCharacter.FromDigit(1),
                        DisplayCharacter.FromDigit(2),
                        frame);
        }
예제 #6
0
        public void Decimal_NegativeOneIntegralOneFractional()
        {
            var frame = CreateFrameDecimal(-1.2m);

            AssertFrame(false, false, false,
                        DisplayCharacter.FromSymbol('-'),
                        DisplayCharacter.FromDigit(1, true),
                        DisplayCharacter.FromDigit(2),
                        frame);
        }
예제 #7
0
        public void Decimal_PositiveZeroAndOneFractional()
        {
            var frame = CreateFrameDecimal(0.2m);

            AssertFrame(false, false, false,
                        DisplayCharacter.Empty,
                        DisplayCharacter.FromDigit(0, true),
                        DisplayCharacter.FromDigit(2),
                        frame);
        }
예제 #8
0
    private void DrawMap()
    {
        var halfWidth  = VirtualConsole.instance.width / 2;
        var halfHeight = ((VirtualConsole.instance.height - 15) / 2) + 15;

        for (int x = posX - halfWidth; x < posX + halfWidth; x++)
        {
            for (int y = posY - halfHeight; y < posY + halfHeight; y++)
            {
                if (x == posX && y == posY)
                {
                    continue;
                }
                DisplayCharacter dc = null;
                if (Visible(x, y) && GetMonsters(x, y) != "")
                {
                    continue;
                }
                if (Visible(x, y) && GetProjectiles(x, y) != "")
                {
                    continue;
                }
                if (y - posY + halfHeight <= 15)
                {
                    continue;
                }
                if (x >= 0 && y >= 0 && x < MapFloor.xSize && y < MapFloor.ySize)
                {
                    dc = currentFloor.layout[x, y];
                }
                if (dc != null && Visible(x, y))
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, dc.character, dc.color.r, dc.color.g, dc.color.b, dc.bgColor.r, dc.bgColor.g, dc.bgColor.b);
                }
                else if (Visible(x, y))
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, Get(x, y));
                }
                else if (dc != null && Seen(x, y))
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, dc.character, dc.color.r / 4f, dc.color.g / 4f, dc.color.b / 4f, dc.bgColor.r / 4f, dc.bgColor.g / 4f, dc.bgColor.b / 4f);
                }
                else
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, " ");
                }
            }
        }
        VirtualConsole.Set(halfWidth, halfHeight, "@");
    }
예제 #9
0
 private static void AssertFrame(
     bool expectedRed,
     bool expectedGreen,
     bool expectedBlue,
     DisplayCharacter expectedLeft,
     DisplayCharacter expectedMiddle,
     DisplayCharacter expectedRight,
     DisplayFrame actual
     )
 {
     Assert.AreEqual(expectedRed, actual.StatusLeds[StatusLed.Red]);
     Assert.AreEqual(expectedGreen, actual.StatusLeds[StatusLed.Green]);
     Assert.AreEqual(expectedBlue, actual.StatusLeds[StatusLed.Blue]);
     Assert.AreEqual(expectedLeft.Value, actual.Characters[2].Value);
     Assert.AreEqual(expectedMiddle.Value, actual.Characters[1].Value);
     Assert.AreEqual(expectedRight.Value, actual.Characters[0].Value);
 }
예제 #10
0
    private void DrawProjectiles()
    {
        var halfWidth  = VirtualConsole.instance.width / 2;
        var halfHeight = ((VirtualConsole.instance.height - 15) / 2) + 15;

        for (int x = posX - halfWidth; x < posX + halfWidth; x++)
        {
            for (int y = posY - halfHeight; y < posY + halfHeight; y++)
            {
                if (GetProjectiles(x, y) == "")
                {
                    continue;
                }
                DisplayCharacter dc = null;
                if (x >= 0 && y >= 0 && x < MapFloor.xSize && y < MapFloor.ySize)
                {
                    dc = currentFloor.projectiles[x, y].display;
                }
                if (dc != null && Visible(x, y))
                {
                    VirtualConsole.Set(x - posX + halfWidth, y - posY + halfHeight, dc.character, dc.color.r, dc.color.g, dc.color.b, dc.bgColor.r, dc.bgColor.g, dc.bgColor.b);
                }
                if (currentFloor.projectiles[x, y].blastStage > -1)
                {
                    var proj = currentFloor.projectiles[x, y];
                    for (int x2 = proj.x - proj.blastStage; x2 <= proj.x + proj.blastStage; x2++)
                    {
                        for (int y2 = proj.y - proj.blastStage; y2 <= proj.y + proj.blastStage; y2++)
                        {
                            if (Visible(x2, y2))
                            {
                                VirtualConsole.Set(x2 - posX + halfWidth, y2 - posY + halfHeight, dc.character, dc.color.r, dc.color.g, dc.color.b, dc.bgColor.r, dc.bgColor.g, dc.bgColor.b);
                            }
                        }
                    }
                }
            }
        }
    }