Esempio n. 1
0
 public static void F2()
 {
     WorldRendering.drawWorld(-1);
     WorldRendering.drawUnits(-1);
     _DEBUG.AddDebugMessage("clairvoyance... Press any key");
     Console.ReadKey(true);
 }
Esempio n. 2
0
        public void Loop()
        {
            ConsoleKeyInfo keyPressed;

            //drawWorld();
            while (true)
            {
                if (player.Timing.IsTimeToAct())
                {
                    if (player.seesAsUsual())
                    {
                        WorldRendering.drawWorld(0);
                    }
                    player.DrawStatusbar();
                    keyPressed = Console.ReadKey(true);
                    if (keyPressed.Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                    if (keyPressed.Key == ConsoleKey.F1)
                    {
                        HelpScreen.DrawHelpScreen();
                        Log.DrawMiniLog();
                        continue;
                    }

                    if (_DEBUG.DebugKey(keyPressed)) //DEBUG-ONLY
                    {
                        continue;
                    }

                    player.handleKeys(keyPressed);

                    if (player.Timing.IsTimeToAct()) //don't do anything if player did nothing at all
                    {
                        continue;
                    }
                }
                for (int i = 0; i < AllActors.Count; i++)
                {
                    Actor currActor = AllActors[i];
                    if (currActor.Hitpoints <= 0)
                    {
                        AllItemsOnFloor.Add(new Corpse(currActor));
                        Log.AddLine(currActor.Name + " drops dead!");
                        AllActors.Remove(currActor);
                        i--;
                        continue;
                    }
                    if (currActor.KnockedOutTime > 0)
                    {
                        AllItemsOnFloor.Add(new UnconsciousBody(currActor));
                        Log.AddLine(currActor.Name + " falls unconscious!");
                        AllActors.Remove(currActor);
                        i--;
                        continue;
                    }
                    if (currActor.Timing.IsTimeToAct())
                    {
                        currActor.DoSomething();
                    }
                }
                if (player.Hitpoints <= 0) //GAME OVER
                {
                    Gameover.ShowGameoverScreen();
                    break;
                }
                for (int i = 0; i < AllItemsOnFloor.Count; i++)
                {
                    if (AllItemsOnFloor[i] is UnconsciousBody)
                    {
                        UnconsciousBody curr = ((UnconsciousBody)AllItemsOnFloor[i]);
                        if (curr.TimeToWakeUp())
                        {
                            AllActors.Add((Actor)curr.Knocked);
                            Log.AddLine(((Actor)curr.Knocked).Name + " wakes up!");
                            AllItemsOnFloor.Remove(curr);
                            i--;
                            continue;
                        }
                    }
                }
                TurnTiming.Tick();
            }
        }