コード例 #1
0
 public void DoSomething() //main AI method
 {
     Check();
     if (Timing.GetCurrentTurn() > StateTimeout)
     {
         CurrentState = State.patrolling;
     }
     //if is waiting for something then do nothing, huh
     if (CurrentState == State.waiting)
     {
         return;
     }
     if (CurrentState == State.patrolling)
     {
         DoPatrolling();
     }
     if (CurrentState == State.attacking)
     {
         DoAttacking();
     }
     if (CurrentState == State.investigating)
     {
         DoInvestigating();
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: sidav/StealthRoguelike
        public void DrawStatusbar()
        {
            Console.SetCursorPosition(0, Program.consoleHeight - 2);

            if (Hitpoints > 2 * GetMaxHitpoints() / 3)
            {
                Console.ForegroundColor = ConsoleColor.DarkGreen;
            }
            if (Hitpoints > GetMaxHitpoints() / 3 && Hitpoints <= 2 * GetMaxHitpoints() / 3)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
            }
            if (Hitpoints <= GetMaxHitpoints() / 3)
            {
                Console.ForegroundColor = ConsoleColor.Red;
            }

            Console.Write("HP: " + Hitpoints.ToString() + "/" + GetMaxHitpoints().ToString() + ";");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write(" Time: " + Timing.GetCurrentTurn() / 10 + "." + Timing.GetCurrentTurn() % 10 + ";"); ///THIS might be not cool...
            Console.Write(" Wielding: " + Inv.Wielded.DisplayName + ";");
            int cx = Console.CursorLeft;
            int cy = Console.CursorTop;

            for (int i = 0; i < Program.consoleWidth; i++)
            {
                Console.Write(" ");
            }
            Console.SetCursorPosition(cx, cy);
            if (Inv.isCarryingABody())
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(" Carrying a " + Inv.BodyCarrying.DisplayName);
                //_DEBUG.AddDebugMessage("Watafuq? Body is " + Inv.BodyCarrying.DisplayName);
            }
            else
            {
                Console.Write("                                 ");
            }

            //Text statuses (like, "poisoned", "frightened" etc)
            Console.SetCursorPosition(0, Program.consoleHeight - 1);
            int burden = Inv.getEncumbrance();

            if (burden == 1)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write("Burdened ");
            }
            if (burden == 2)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("Very burdened ");
            }
            if (burden == 3)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                Console.BackgroundColor = ConsoleColor.Red;
                Console.Write("Overburdened ");
                Console.BackgroundColor = ConsoleColor.Black;
            }
        }
コード例 #3
0
 void addStateTimeout(int value)
 {
     StateTimeout = Timing.GetCurrentTurn() + value;
 }