예제 #1
0
    //turn execution
    public void Clicked()
    {
        if ((currentTurn < turnLimit) && (gameOver == false))
        {
            currentTurn += 1;

            turnDisplay.text = "End turn " + currentTurn;

            //sea level calculations
            seaLevel.UpdateSeaLevel();

            /* Collect effective production after eventual flood */
            p1Production.UpdateProduction();
            p2Production.UpdateProduction();

            /* Apply delayed actions first */
            foreach (Action action in ActionsForTurn(currentTurn))
            {
                action();
            }

            ResourceValues playerOneResources = p2Resources.trade;
            ResourceValues playerTwoResources = p1Resources.trade;

            //collecting all the resources
            playerOneResources.Add(p1Production.production);
            playerTwoResources.Add(p2Production.production);

            //update game with new amount of resources from production on every turn but 1st
            p1Resources.UpdateResourceCount(playerOneResources);
            p2Resources.UpdateResourceCount(playerTwoResources);

            //draw a new hand of policies for each players
            p1Cards.DrawNewHand();
            p2Cards.DrawNewHand();
        }
        else if (currentTurn == turnLimit)
        {
            currentTurn += 1; // Increment so we don't restart the music each click
            musicController.PlayLevel(4);
            GameOver("You win!");
        }
    }
예제 #2
0
        public void ProductionController_UpdateProduction_Pass()
        {
            // Arrange
            var dbcontext      = new BroadwayBuilderContext();
            var theaterService = new TheaterService(dbcontext);

            var theater = new Theater()
            {
                TheaterName   = "The Magicians",
                StreetAddress = "Pantene",
                State         = "CA",
                City          = "LA",
                CompanyName   = "123 Sesame St",
                Country       = "US",
                PhoneNumber   = "123456789"
            };

            theaterService.CreateTheater(theater);
            dbcontext.SaveChanges();


            var productionService = new ProductionService(dbcontext);

            var production = new Production()
            {
                ProductionName    = "The Lion King",
                DirectorFirstName = "Jane",
                DirectorLastName  = "Doe",
                Street            = "Anahiem",
                City          = "Long Beach",
                StateProvince = "California",
                Country       = "United States",
                Zipcode       = "919293",
                TheaterID     = theater.TheaterID
            };

            production.ProductionName   = "The Updated Lion King";
            production.StateProvince    = "Utah";
            production.DirectorLastName = "Mangos";

            productionService.CreateProduction(production);
            dbcontext.SaveChanges();

            var productionController = new ProductionController();

            // Act

            var actionResult = productionController.UpdateProduction(production);

            var response          = actionResult as OkNegotiatedContentResult <Production>;
            var updatedProduction = response.Content;

            productionService.DeleteProduction(response.Content.ProductionID);
            dbcontext.SaveChanges();
            theaterService.DeleteTheater(theater);
            dbcontext.SaveChanges();
            // Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(production.ProductionID, updatedProduction.ProductionID);
            Assert.AreEqual("The Updated Lion King", updatedProduction.ProductionName);
            Assert.AreEqual("Utah", updatedProduction.StateProvince);
            Assert.AreEqual("Mangos", updatedProduction.DirectorLastName);
        }