예제 #1
0
 public void AddRequestOfProd(int price, int amount, Director director)
 {
     RequestsOfProd.Add(new Offer(price, amount, GetPriority(director)));
 }
예제 #2
0
        public GameState GoNextState()
        {
            //end of state
            if (CurrentState == GameState.FixCosts)
            {
                //nothing
            }
            else if (CurrentState == GameState.UpdateMarket)
            {
                //nothing
            }
            else if (CurrentState == GameState.MatRequest)
            {
                RequestsOfMat = Bank.RequestOfMat(RequestsOfMat);
                foreach (Demand demand in RequestsOfMat)
                {
                    GetDirector(demand.Priority).MakeRequestOfMat(demand.Price, demand.UMat);
                }
                RequestsOfMat.Clear();
            }
            else if (CurrentState == GameState.Production)
            {
                foreach (Director director in Directors)
                {
                    director.NextState(this);
                }
            }
            else if (CurrentState == GameState.ProdRequest)
            {
                RequestsOfProd = Bank.RequestOfProd(RequestsOfProd);
                foreach (Offer offer in RequestsOfProd)
                {
                    GetDirector(offer.Priority).MakeRequestOfProd(offer.Price, offer.UProd);
                }
                RequestsOfProd.Clear();
            }
            else if (CurrentState == GameState.BuildUpgrade)
            {
                foreach (Director director in Directors)
                {
                    director.UpdateFabCosts();
                }
            }

            CurrentState = GetNextState;

            // start of new state
            if (CurrentState == GameState.FixCosts)
            {
                CurrentMonth += 1;
                Director currentMain = GetDirector(0);
                foreach (Director director in Directors.ToList())
                {
                    director.NextState(this);
                    if (director.IsBankrupt)
                    {
                        if (currentMain != null)
                        {
                            CurrentMainDirector--;
                        }
                        Directors.Remove(director);
                    }
                    if (currentMain == director)
                    {
                        currentMain = null;
                    }
                }
                CurrentMainDirector = (CurrentMainDirector + 1) % Directors.Count;
            }
            else if (CurrentState == GameState.UpdateMarket)
            {
                Bank.NextState(this);
            }
            else if (CurrentState == GameState.MatRequest)
            {
                //wait for requests
            }
            else if (CurrentState == GameState.Production)
            {
                //wait for production
            }
            else if (CurrentState == GameState.ProdRequest)
            {
                //wait for requests
            }
            else if (CurrentState == GameState.BuildUpgrade)
            {
                foreach (Fabric fabric in Fabrics.ToList())
                {
                    fabric.NextState(this);
                }
            }

            return(CurrentState);
        }
예제 #3
0
 public void AddRequestOfMat(int price, int amount, Director director)
 {
     RequestsOfMat.Add(new Demand(price, amount, GetPriority(director)));
 }