Ejemplo n.º 1
0
        static void SomeoneBusted(Cop cop, Robber robber)
        {
            int copClocks          = cop.SiezedItems.OfType <Item>().Where(x => x.ItemName == "Clock").Count();
            int copCash            = cop.SiezedItems.OfType <Item>().Where(x => x.ItemName == "Cash").Count();
            int copKeys            = cop.SiezedItems.OfType <Item>().Where(x => x.ItemName == "Keys").Count();
            int copPhone           = cop.SiezedItems.OfType <Item>().Where(x => x.ItemName == "Phone").Count();
            int offsetFromTop      = 4;
            int middlePositionLeft = GameField.GameWidth / 2;

            string[] toPrint = { "========================",
                                 " A cop has busted ",
                                 " a robber! ",
                                 " This is his current ",
                                 " inventory. ",            "========================",
                                 $" Clock x {copClocks}",
                                 $" Cash x {copCash}",
                                 $" Keys x {copKeys}",
                                 $" Phone x {copPhone}",
                                 " ",
                                 "========================" };
            int      lastLine   = toPrint.Length;
            int      lastColumn = middlePositionLeft + toPrint[0].Length + 1; //när looten ska försvinna behöver den funktionen veta hur långa raderna var, (jag har gjort alla raden lika långa)


            ConsoleFunctions.PrintWho(robber);
            ConsoleFunctions.PrintInfoStatScreen(toPrint, offsetFromTop, middlePositionLeft);
            Thread.Sleep(5000);
            Prison.PrisonTimerTick();
            Prison.PutRobberInJail(robber); // råraren hamnar i finkan, men får inte sin tid plussad då han egentligen inte har suttit inne än
            ConsoleFunctions.ResetPartialScreen(offsetFromTop, middlePositionLeft, offsetFromTop + lastLine, offsetFromTop + lastColumn);
            Console.SetCursorPosition(0, GameField.GameHeight + 1);
        }
Ejemplo n.º 2
0
        public static void SomeoneRobbed(Citizen citizen, Robber robber)
        {
            int robberClocks       = robber.StolenGoods.OfType <Item>().Where(x => x.ItemName == "Clock").Count();
            int robberCash         = robber.StolenGoods.OfType <Item>().Where(x => x.ItemName == "Cash").Count();
            int robberKeys         = robber.StolenGoods.OfType <Item>().Where(x => x.ItemName == "Keys").Count();
            int robberPhone        = robber.StolenGoods.OfType <Item>().Where(x => x.ItemName == "Phone").Count();
            int citizenClocks      = citizen.Belongings.OfType <Item>().Where(x => x.ItemName == "Clock").Count();
            int citizenCash        = citizen.Belongings.OfType <Item>().Where(x => x.ItemName == "Cash").Count();
            int citizenKeys        = citizen.Belongings.OfType <Item>().Where(x => x.ItemName == "Keys").Count();
            int citizenPhone       = citizen.Belongings.OfType <Item>().Where(x => x.ItemName == "Phone").Count();
            int offsetFromTop      = 4;
            int middlePositionLeft = GameField.GameWidth / 2;

            string[] toPrint = { "========================",
                                 " A robber has stolen ",
                                 " from a citizen! ",
                                 " This is their current ",
                                 " inventories. ",
                                 "======ROBBER============",
                                 $" Clock x {robberClocks}",
                                 $" Cash x {robberCash}",
                                 $" Keys x {robberKeys}",
                                 $" Phone x {robberPhone}",
                                 " ",
                                 "======CITIZEN===========",
                                 $" Clock x {citizenClocks}",
                                 $" Cash x {citizenCash}",
                                 $" Keys x {citizenKeys}",
                                 $" Phone x {citizenPhone}",
                                 " ",
                                 "========================" };

            int lastLine   = offsetFromTop + toPrint.Length;
            int lastColumn = middlePositionLeft + toPrint[0].Length + 1;

            ConsoleFunctions.PrintWho(citizen); //visar en pil brevid personen som det hände något med

            ConsoleFunctions.PrintInfoStatScreen(toPrint, offsetFromTop, middlePositionLeft);


            Thread.Sleep(5000);
            ConsoleFunctions.ResetPartialScreen(offsetFromTop, middlePositionLeft, lastLine, lastColumn);
            Prison.PrisonTimerTick();
            Console.SetCursorPosition(0, GameField.GameHeight + 1);
        }