Example #1
0
 public override void Trigger(Player player)
 {
     PlayerArrivedEvent(this, new PlayerArrivedEventArgs(player));
     string[] choices = { "Welcom to the bank! How can I help you?", "1.Deposit", "2.Withdraw", "3.Leave" };
     int choice = player.Choose(choices);
     while (choice != 3)
     {
         switch (choice)
         {
             case 1:
                 if (player.Deposit(player.InputInt("How much?")))
                 {
                     player.Inform("Done!");
                 }
                 else
                 {
                     player.Inform("Failed!");
                 }
                 break;
             case 2:
                 if (player.Withdraw(player.InputInt("How much?")))
                 {
                     player.Inform("Done!");
                 }
                 else
                 {
                     player.Inform("Failed!");
                 }
                 break;
             default:
                 throw new Exception();
         }
         choice = player.Choose(choices);
     }
 }
Example #2
0
        public override void Trigger(Player player)
        {
            PlayerArrivedEvent(this, new PlayerArrivedEventArgs(player));
            string[] choices = { "Welcom to the bank! How can I help you?", "1.Deposit", "2.Withdraw", "3.Leave" };
            int      choice  = player.Choose(choices);

            while (choice != 3)
            {
                switch (choice)
                {
                case 1:
                    if (player.Deposit(player.InputInt("How much?")))
                    {
                        player.Inform("Done!");
                    }
                    else
                    {
                        player.Inform("Failed!");
                    }
                    break;

                case 2:
                    if (player.Withdraw(player.InputInt("How much?")))
                    {
                        player.Inform("Done!");
                    }
                    else
                    {
                        player.Inform("Failed!");
                    }
                    break;

                default:
                    throw new Exception();
                }
                choice = player.Choose(choices);
            }
        }