예제 #1
0
 public void Draw(int nCards)
 {
     for (int i = 0; i < nCards; i++)
     {
         hand.Add(OpsCard.Random());
     }
 }
예제 #2
0
        public static OpsCard Random()
        {
            Random random     = new Random();
            int    nLifelines = random.Next(1, 4);

            Lifeline[] lifelines = new Lifeline[nLifelines];
            Lifeline   lifeline  = Extensions.GetRandomLifeline();

            for (int i = 0; i < nLifelines; i++)
            {
                lifelines[i] = lifeline;
            }

            string name;

            switch (lifeline)
            {
            case Lifeline.Communication:
                name = "Telecom Repair Team";
                break;

            case Lifeline.Energy:
                name = "Generator";
                break;

            case Lifeline.FoodWaterShelter:
                name = "Local School";
                break;

            case Lifeline.HazardousMaterial:
                name = "HazMat Team";
                break;

            case Lifeline.HealthMedical:
                name = "Paramedic";
                break;

            case Lifeline.SafetySecurity:
                name = "Police Officer";
                break;

            case Lifeline.Transportation:
                name = "Bus";
                break;

            default:
                name = "Random resource!";
                break;
            }
            OpsCard card = new OpsCard(name, lifelines);

            return(card);
        }
예제 #3
0
        static Game NewGame()
        {
            Disaster disaster = Disaster.Random();

            int            handCount = 5;
            List <OpsCard> hand      = new List <OpsCard>();

            for (int i = 0; i < handCount; i++)
            {
                hand.Add(OpsCard.Random());
            }

            Game game = new Game(disaster, hand);

            return(game);
        }