public void TestGetTimeMatrixIndex(PositionCodes code, int expected)
        {
            var state = new ProductionState();
            var res   = state.GetTimeMatrixIndex(code);

            Assert.AreEqual(expected, res);
        }
Esempio n. 2
0
        private void GenerateWarehouseState(ProductionState state)
        {
            double DistanceFunc(double time, double maxTime) => (1 + (-time / maxTime));
            double UniformFunc(int validCount) => (1.0 / validCount);
            Dictionary <(int row, int col), double> ComputeTimeAdvantageForCells(List <(int row, int col)> validPositions, double maximum) => validPositions.ToDictionary(k => ((k.row, k.col)), t => DistanceFunc(state.TimeMatrix[t.row, t.col], maximum));

            var validPositions = ((PositionCodes[])Enum.GetValues(typeof(PositionCodes)))
                                 .Where(t => t != PositionCodes.Service && t != PositionCodes.Stacker)
                                 .Select(t => state.GetWarehouseIndex(t))
                                 .ToList();

            var timeMatrixMaximum    = state.TimeMatrix.Cast <double>().Max();
            var timeAdvantageForCell = ComputeTimeAdvantageForCells(validPositions, timeMatrixMaximum);
            int numberOfMqbItems     = MaximumOfMqbItems - state.ProductionHistory.Count(t => t == ItemState.MQB);
            int numberOfMebItems     = MaximumOfMebItems - state.ProductionHistory.Count(t => t == ItemState.MEB);
            int numberOfFreeSlots    = MaximumFreeSlotsInWarehouse - numberOfMqbItems - numberOfMebItems;

            var randomPermutationOfItems = Enumerable.Repeat(ItemState.MEB, numberOfMebItems)
                                           .Concat(Enumerable.Repeat(ItemState.MQB, numberOfMqbItems))
                                           .OrderBy(_ => RandomGenerator.Next())
                                           .ToList();

            foreach (var item in randomPermutationOfItems)
            {
                double uniformProb   = UniformFunc(validPositions.Count);
                double weight        = item == ItemState.MEB ? MebDistanceWeight : MqbDistanceWeight;
                var    validProbs    = validPositions.Select(t => UniformProbabilityWeight * uniformProb + timeAdvantageForCell[(t.row, t.col)] * weight).Softmax();
        public void TestGetWarehouseIndex(PositionCodes code, int expectedRow, int expectedCol)
        {
            var state = new ProductionState();
            var res   = state.GetWarehouseIndex(code);

            Assert.AreEqual((expectedRow, expectedCol), res);
        }
Esempio n. 4
0
        public override void OnUpdate(int unixTime)
        {
            if (unixTime < constructionStartTime + constructionDuration)
            {
                ProductionState = ProductionState.Construct;
                return;
            }

            if (unixTime < productionStartTime + incomeInterval)
            {
                ProductionState = ProductionState.Production;
            }
            else
            {
                if (type != ProductionBuildingType.Auto)
                {
                    if (ProductionState != ProductionState.Idle)
                    {
                        if (productionStartTime != 0)
                        {
                            Collect();
                        }
                        ProductionState = ProductionState.Idle;
                    }
                }
                else
                {
                    if (productionStartTime != 0)
                    {
                        Collect();
                    }
                    productionStartTime = unixTime;
                }
            }
        }
Esempio n. 5
0
 void Update()
 {
     if (state == ProductionState.IDLE)
     {
         if (toBeCreatedQueue.Count > 0)
         {
             state = ProductionState.PRODUCING;
             prodQueueSizeText.text = toBeCreatedQueue.Count.ToString();
             toBeCreated            = toBeCreatedQueue.Dequeue();
             productionTimeStart    = Time.time;
         }
         else
         {
             prodQueueSizeText.text = "0";
         }
     }
     else
     {
         productionTime = toBeCreated.GetComponent <Weapon>().productionTime;
         float elapsedTime = Time.time - productionTimeStart;
         UpdateProductionCtrBar(elapsedTime);
         if (productionTime <= elapsedTime)
         {
             CreateWeapon(toBeCreated);
             toBeCreated = null;
             state       = ProductionState.IDLE;
         }
     }
 }
Esempio n. 6
0
 public override void SpawnFromPool()
 {
     base.SpawnFromPool();
     _state           = ProductionState.EMPTY;
     currentTransform = transform;
     _startScale      = currentTransform.localScale;
     StartCoroutine(Grow());
 }
Esempio n. 7
0
 public void ChangeProductionState(ProductionState state)
 {
     if (this.CurrProductionState == state)
     {
         return;
     }
     this.PrevProductionState = this.CurrProductionState;
     this.CurrProductionState = state;
     Logger.DEFAULT.Info(LogCategory.RUNNING, "", string.Format("change production state: {0}", state));
     this.ProductionStateChanged?.Invoke(this.CurrProductionState);
 }
Esempio n. 8
0
        public override bool NextStep()
        {
            if (ProductionState.FutureProductionPlan.Count == 0)
            {
                return(false);
            }

#if HISTORY
            History.Push(ProductionState.Copy());
#endif

            var needed  = ProductionState.FutureProductionPlan.Dequeue();
            var current = ProductionState.ProductionHistory.Dequeue();
            ProductionState.ProductionHistory.Enqueue(needed);

            var nearestFreePosition = GetNearestEmptyPosition(ProductionState);
            (int r, int c) = ProductionState.GetWarehouseIndex(nearestFreePosition);
            ProductionState.WarehouseState[r, c] = current;

            var nearestNeededPosition = GetNearesElementWarehousePosition(ProductionState, needed);
            (r, c) = ProductionState.GetWarehouseIndex(nearestNeededPosition);
            ProductionState.WarehouseState[r, c] = ItemState.Empty;

            var insertTime = ProductionState.TimeMatrix[ProductionState.GetTimeMatrixIndex(PositionCodes.Stacker), ProductionState.GetTimeMatrixIndex(nearestFreePosition)];
            var moveToDifferentCellTime = ProductionState.TimeMatrix[ProductionState.GetTimeMatrixIndex(nearestFreePosition), ProductionState.GetTimeMatrixIndex(nearestNeededPosition)] - 5; // TODO: Validate this calculation
            moveToDifferentCellTime = moveToDifferentCellTime < 0 ? 0 : moveToDifferentCellTime;
            var withdrawTime = ProductionState.TimeMatrix[ProductionState.GetTimeMatrixIndex(nearestNeededPosition), ProductionState.GetTimeMatrixIndex(PositionCodes.Stacker)];
            var totalTime    = insertTime + moveToDifferentCellTime + withdrawTime;
            ProductionState.CurrentStepTime        = totalTime;
            ProductionState.TimeSpentInSimulation += totalTime;

            ProductionState.ProductionStateIsOk = ProductionState.ProductionStateIsOk && totalTime <= TimeLimit;
            RealTime += ClockTime;
            if (totalTime > TimeLimit)
            {
                Delay    += totalTime - TimeLimit;
                RealTime += totalTime - TimeLimit;
            }
            ProductionState.StepCounter++;

            StepLog.Add(new StepModel
            {
                InsertToCell            = nearestFreePosition,
                WithdrawFromCell        = nearestNeededPosition,
                InsertType              = current,
                WithdrawType            = needed,
                InsertTime              = insertTime,
                MoveToDifferentCellTime = moveToDifferentCellTime,
                WithdrawTime            = withdrawTime
            });

            return(true);
        }
Esempio n. 9
0
        public ProductionState GenerateProductionState()
        {
            var res = new ProductionState()
            {
                TimeMatrix = TimeMatrix
            };

            res.FutureProductionPlan = new Queue <ItemState>(FutureProductionPlanGenerator.GenerateSequence());
            res.ProductionHistory    = new Queue <ItemState>(ProductionHistoryGenerator.GenerateSequence());
            GenerateWarehouseState(res);
            return(res);
        }
Esempio n. 10
0
 public ProductionStateLoader(List <ProductionScenarioPaths> scenarios, string timeMatrixCsvPath)
 {
     DefaultScenarios         = scenarios;
     TimeMatrixCsvPath        = timeMatrixCsvPath;
     DefaultScenariosInMemory = DefaultScenarios.Select(current => {
         var productionState = new ProductionState();
         productionState.LoadTimeMatrix(TimeMatrixCsvPath);
         productionState.LoadWarehouseState(current.WarehouseInitialStateCsv);
         productionState.LoadFutureProductionPlan(current.FutureProductionListCsv);
         productionState.LoadProductionHistory(current.HistoricalProductionListCsv);
         return(productionState);
     }).ToList();
 }
Esempio n. 11
0
 private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (_diff.TotalSeconds <= 0 || ProductionState == ProductionState.Finished || ProductionState == ProductionState.Idle)
     {
         if (ProductionState != ProductionState.Idle && timer.Enabled)
         {
             timer.Enabled = false;
             timer.Stop();
             Debug.WriteLine($"[{DateTime.Now}] Production done");
             ProductionState = ProductionState.Finished;
             if (lblState.InvokeRequired)
             {
                 Invoker.SetProperty(lblState, () => lblState.Text, i18n.getString("ProductionFinishedState"));
             }
             else
             {
                 lblState.Text = i18n.getString("ProductionFinishedState");
             }
             if (ProductionState == ProductionState.Finished && !StaticData.UserData.ProductionBot)
             {
                 _UpdateGUI?.Invoke(this);
             }
             return;
         }
         else if (ProductionState == ProductionState.Idle && timer.Enabled)
         {
             timer.Enabled = false;
             timer.Stop();
             Debug.WriteLine($"[{DateTime.Now}] Production idle");
             ProductionState = ProductionState.Idle;
             if (lblState.InvokeRequired)
             {
                 Invoker.SetProperty(lblState, () => lblState.Text, i18n.getString("ProductionIdle"));
             }
             else
             {
                 lblState.Text = i18n.getString("ProductionIdle");
             }
             if (ProductionState == ProductionState.Idle && !StaticData.UserData.ProductionBot)
             {
                 _UpdateGUI?.Invoke(this);
             }
             return;
         }
         else if (!timer.Enabled)
         {
             return;
         }
     }
     UpdateGUI();
 }
Esempio n. 12
0
 public void StartProduction()
 {
     if (EntityIDs.Count <= 0)
     {
         return;
     }
     foreach (int id in EntityIDs)
     {
         string script;
         if (isGoodBuilding)
         {
             script = StaticData.ReqBuilder.GetRequestScript(DataHandler.RequestType.QueryProduction, new int[] { id, StaticData.UserData.GoodProductionOption.id });
         }
         else
         {
             script = StaticData.ReqBuilder.GetRequestScript(DataHandler.RequestType.QueryProduction, new int[] { id, StaticData.UserData.ProductionOption.id });
         }
         string ret = (string)jsExecutor.ExecuteAsyncScript(script);
         try
         {
             JToken ColRes = JsonConvert.DeserializeObject <JToken>(ret);
             if (ColRes["responseData"]?["updatedEntities"]?.ToList().Count > 0 && ColRes["responseData"]?["updatedEntities"]?[0]?["state"]?["__class__"]?.ToString() == "ProducingState")
             {
                 ProductionState = ProductionState.Producing;
                 StaticData.Updater.UpdateEntities();
             }
             else
             {
                 if (StaticData.DEBUGMODE)
                 {
                     Helper.Log($"[{DateTime.Now}] Failed to Start Production");
                 }
             }
             if (StaticData.DEBUGMODE)
             {
                 Helper.Log($"[{DateTime.Now}] CollectedIDs Count = {EntityIDs.Count}");
             }
         }
         catch (Exception ex)
         {
             NLog.LogManager.Flush();
             var attachments = new ErrorAttachmentLog[] { ErrorAttachmentLog.AttachmentWithText(File.ReadAllText("log.foblog"), "log.foblog") };
             var properties  = new Dictionary <string, string> {
                 { "CollectProduction", ret }
             };
             Crashes.TrackError(ex, properties, attachments);
         }
         Thread.Sleep(100);
     }
     UpdateGUI();
 }
        private int SimulateProcessing(ProductionState productionState, int numberOfImagenarySteps)
        {
            ProductionState localProductionState = (ProductionState)productionState.Clone();
            int             counter = 0;

            while (localProductionState.FutureProductionPlan.Count < numberOfImagenarySteps)
            {
                localProductionState.FutureProductionPlan.Enqueue(localProductionState.FutureProductionPlan.ElementAt(counter++));
            }
            NaiveController naiveController = new NaiveController(localProductionState);

            while (naiveController.NextStep() && naiveController.ProductionState.ProductionStateIsOk && --numberOfImagenarySteps > 0)
            {
            }
            return(numberOfImagenarySteps);
        }
Esempio n. 14
0
        public MainWindow()
        {
            InitializeComponent();
            var                        productionState         = new ProductionState();
            var                        scenarioLoader          = new ProductionStateLoader(LoadScenarionPaths("InputFiles"), "InputFiles/ProcessingTimeMatrix.csv");
            var                        naiveController         = new NaiveController(productionState);
            BaseController             asyncController         = new NaiveAsyncControllerWithHalfCycleDelay(productionState);
            GreedyWarehouseReorganizer reorganizer             = new GreedyWarehouseReorganizer();
            RealProductionSimulator    realProductionSimulator = new RealProductionSimulator(naiveController, null);
            //ViewModel = new MainWindowViewModel(naiveController, scenarioLoader);
            var openFileDialog = new OpenFileDialogService();
            IOpenFileService openFolderDialog = new OpenFolderDialogService();

            ViewModel   = new MainWindowViewModel(naiveController, asyncController, reorganizer, realProductionSimulator, scenarioLoader, openFileDialog, openFolderDialog, DialogCoordinator.Instance);
            DataContext = ViewModel;
        }
    void MonitorProductionState()
    {
        if (_currentState == _gameManager.CurrentProduction)
        {
            return;
        }

        _currentState = _gameManager.CurrentProduction;

        if (_currentlyActivePlayer != movingPlayer)
        {
            _currentlyActivePlayer.SetActive(false);
        }

        movingPlayer.SetActive(true);
        SetMovePosition();
        _isMoving = true;
    }
Esempio n. 16
0
        private IEnumerator Grow()
        {
            var waiter = new WaitForSeconds(_timeDelta);

            _state = ProductionState.GROW;
            var _currentTime = _growTime;
            var pos          = currentTransform.position;

            while (_currentTime > 0)
            {
                currentTransform.localScale = Vector3.Lerp(_startScale, _maxScale, (_growTime - _currentTime) / _growTime);
                pos.y = _maxGrowPosDelta * _timeDelta / _growTime;
                currentTransform.position = pos;
                yield return(waiter);

                _currentTime -= _timeDelta;
            }
            _state = ProductionState.READY;
        }
        public void ReorganizeWarehouse(ProductionState productionState, List <BaseStepModel> logger, double reservedTime)
        {
            var bestSwaps        = GetBestSwaps(productionState, reservedTime);
            var previousPosition = PositionCodes.Stacker;

            if (bestSwaps.Count == 0)
            {
                logger.Add(new BaseStepModel()
                {
                    Message = "No better warehouse item organization was found during the break"
                });
            }

            for (int i = 0; i < bestSwaps.Count; i++)
            {
                WarehouseSwap(productionState, bestSwaps[i], previousPosition, logger, isLastSwap: i == bestSwaps.Count - 1);
                previousPosition = bestSwaps[i].Item2;
            }
        }
        private void WarehouseSwap(ProductionState productionState, Tuple <PositionCodes, PositionCodes> currentSwap, PositionCodes previousPosition, List <BaseStepModel> logger, bool isLastSwap = false)
        {
            (int r, int c) = productionState.GetWarehouseIndex(currentSwap.Item1);
            var    itemType = productionState.WarehouseState[r, c];
            var    swapTime = productionState.SwapWarehouseItems(currentSwap.Item1, currentSwap.Item2);
            double moveToDifferentCellTime;

            moveToDifferentCellTime = productionState.TimeMatrix[
                productionState.GetTimeMatrixIndex(previousPosition),
                productionState.GetTimeMatrixIndex(currentSwap.Item1)
                                      ];

            if (isLastSwap)
            {
                var extraTime = productionState.TimeMatrix[
                    productionState.GetTimeMatrixIndex(currentSwap.Item2),
                    productionState.GetTimeMatrixIndex(PositionCodes.Stacker)
                                ];

                logger.Add(new WarehouseSwapStepModel
                {
                    MoveTime     = moveToDifferentCellTime,
                    SwapFromCell = currentSwap.Item1,
                    SwapTime     = swapTime,
                    SwapToCell   = currentSwap.Item2,
                    SwapElement  = itemType,
                    ExtraTime    = extraTime
                });
            }
            else
            {
                logger.Add(new WarehouseSwapStepModel
                {
                    MoveTime     = moveToDifferentCellTime,
                    SwapFromCell = currentSwap.Item1,
                    SwapTime     = swapTime,
                    SwapToCell   = currentSwap.Item2,
                    SwapElement  = itemType,
                });
            }
        }
        private List <Tuple <PositionCodes, PositionCodes> > GetBestSwaps(ProductionState productionState, double reservedTime)
        {
            Dictionary <int, List <WarehouseReorganizationRecord> > warehouseReorganizationRecordsDict = new Dictionary <int, List <WarehouseReorganizationRecord> >();

            warehouseReorganizationRecordsDict[0] = new List <WarehouseReorganizationRecord>();
            warehouseReorganizationRecordsDict[0].Add(new WarehouseReorganizationRecord
            {
                ProductionState        = productionState,
                Swap                   = null,
                PreviousRecord         = null,
                RemainingTime          = reservedTime,
                MissingSimulationSteps = SimulateProcessing(productionState, 100)
            });

            if (warehouseReorganizationRecordsDict[0][0].MissingSimulationSteps > 0)
            {
                for (int depthIndex = 0; depthIndex < MaxDepth; depthIndex++)
                {
                    ProgressTriggered?.Invoke(this, new ProgressEventArgs()
                    {
                        State = ProgressState.Update, CurrentValue = depthIndex
                    });
                    warehouseReorganizationRecordsDict[depthIndex + 1] = new List <WarehouseReorganizationRecord>();
                    var warehouseReorganizationRecords = warehouseReorganizationRecordsDict[depthIndex].Where(record => record.RemainingTime > 0).ToList();
                    warehouseReorganizationRecordsDict[depthIndex] = warehouseReorganizationRecords.OrderBy(record => record.MissingSimulationSteps).ThenByDescending(record => record.RemainingTime).Take(SelectBestCnt).ToList();

                    for (int topIndex = 0; topIndex < SelectBestCnt && topIndex < warehouseReorganizationRecordsDict[depthIndex].Count; topIndex++)
                    {
                        var currentRecord  = warehouseReorganizationRecordsDict[depthIndex][topIndex];
                        var availableSwaps = currentRecord.ProductionState.GetAvailableWarehouseSwaps();
                        foreach (var swap in availableSwaps)
                        {
                            ProductionState newProductionState = (ProductionState)currentRecord.ProductionState.Clone();
                            var             swapTimeConsumed   = newProductionState.SwapWarehouseItems(swap.Item1, swap.Item2);
                            PositionCodes   previousPosition;
                            if (currentRecord.PreviousRecord == null)
                            {
                                previousPosition = PositionCodes.Stacker;
                            }
                            else
                            {
                                if (currentRecord.PreviousRecord.Swap == null)
                                {
                                    previousPosition = PositionCodes.Stacker;
                                }
                                else
                                {
                                    previousPosition = currentRecord.PreviousRecord.Swap.Item2;
                                }
                            }
                            var moveTime      = productionState.TimeMatrix[productionState.GetTimeMatrixIndex(previousPosition), productionState.GetTimeMatrixIndex(swap.Item1)];
                            var timeToStacker = productionState.TimeMatrix[productionState.GetTimeMatrixIndex(swap.Item2), productionState.GetTimeMatrixIndex(PositionCodes.Stacker)];
                            var timeRemaining = currentRecord.RemainingTime - moveTime - swapTimeConsumed;

                            if (timeRemaining - timeToStacker > 0)
                            {
                                int numberOfMissingSteps = SimulateProcessing(newProductionState, 100);
                                warehouseReorganizationRecordsDict[depthIndex + 1].Add(new WarehouseReorganizationRecord
                                {
                                    ProductionState        = newProductionState,
                                    Swap                   = swap,
                                    PreviousRecord         = currentRecord,
                                    RemainingTime          = timeRemaining,
                                    MissingSimulationSteps = numberOfMissingSteps
                                });
                            }
                        }
                    }
                }
            }

            var allRecords = warehouseReorganizationRecordsDict.Values.SelectMany(x => x).ToList();
            var bestRecord = allRecords.OrderBy(record => record.MissingSimulationSteps).ThenByDescending(record => record.RemainingTime).ToList()[0];

            return(bestRecord.GetSwapsFromRoot());
        }
Esempio n. 20
0
 public NaiveAsyncControllerWithHalfCycleDelay(ProductionState productionState, string csvProcessingTimeMatrix, string csvWarehouseInitialState, string csvHistroicalProduction, string csvFutureProductionPlan) : base(productionState, csvProcessingTimeMatrix, csvWarehouseInitialState, csvHistroicalProduction, csvFutureProductionPlan)
 {
 }
Esempio n. 21
0
 public NaiveAsyncControllerWithHalfCycleDelay(ProductionState state, string csvProcessingTimeMatrix) : base(state, csvProcessingTimeMatrix)
 {
 }
Esempio n. 22
0
    // Update is called once per frame
    //    new void Update () { }
    private void Handle_SushiBeh_putObjectOnTray_Event(object sender, EventArgs e)
    {
        GoodsBeh obj = sender as GoodsBeh;
        if (stageManager.foodTrayBeh.goodsOnTray_List.Contains(obj) == false && stageManager.foodTrayBeh.goodsOnTray_List.Count < FoodTrayBeh.MaxGoodsCapacity)
        {
            stageManager.foodTrayBeh.goodsOnTray_List.Add(obj);
            stageManager.foodTrayBeh.ReCalculatatePositionOfGoods();

            sushi = null;
            this.currentProductionState = ProductionState.None;
        }
        else
        {
            Debug.LogWarning("Goods on tray have to max capacity.");

            obj.transform.position = obj.originalPosition;
        }
    }
Esempio n. 23
0
 private void FSM_ProductionStateChanged(ProductionState obj)
 {
 }
Esempio n. 24
0
 public NaiveController(ProductionState state, string csvProcessingTimeMatrix) : base(state, csvProcessingTimeMatrix)
 {
 }
Esempio n. 25
0
 public NaiveController(ProductionState productionState, string csvProcessingTimeMatrix, string csvWarehouseInitialState, string csvHistroicalProduction, string csvFutureProductionPlan) : base(productionState, csvProcessingTimeMatrix, csvWarehouseInitialState, csvHistroicalProduction, csvFutureProductionPlan)
 {
 }
Esempio n. 26
0
 private void OnEnable()
 {
     productionState = initialProductionState;
 }
Esempio n. 27
0
    public void OnInput(ref string nameInput)
    {
        if(nameInput == SushiIngredientTray) {
            this.InitializeSushiPopupWindows();
        }
        else if(nameInput == ClosePopup) {
            this.sushiPopup.gameObject.SetActiveRecursively(false);
        }
        else if(nameInput == BucketOfRice) {
            if(sushiRice == null && sushi_rice_solution == null && sushi == null) {
                stageManager.choppingBlock_sprite.spriteId = stageManager.choppingBlock_sprite.GetSpriteIdByName("choppingBlock");
                this.currentProductionState = ProductionState.CreateSushiRice;

                sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Sushi_rice_anim, typeof(GameObject))) as GameObject;
                sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId) {
                    Destroy(sushi_rice_solution);

                    GameObject sushiRiceInstance = Instantiate(Resources.Load("FoodSolution/Sushi_rice", typeof(GameObject))) as GameObject;
                    sushiRiceInstance.transform.position = sushiRice_Pos;

                    sushiRice = sushiRiceInstance.GetComponent<ObjectsBeh>();
                    sushiRice._canDragaable = true;
                    sushiRice.originalPosition = sushiRice_Pos;
                    sushiRice.ObjectsBeh_destroyObj_Event = delegate(object sender, System.EventArgs e) {
                        Destroy(sushiRice.gameObject);
                        this.currentProductionState = ProductionState.None;

                        Mz_StorageManage.AvailableMoney -= 1;
                        stageManager.CreateDeductionsCoin(1);
                        stageManager.ReFreshAvailableMoney();
                    };

                    this.currentProductionState = ProductionState.WaitForSushiIngredient;
                };
                // Play sound effect.
                baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
            }
        }
        else if(nameInput == Alga) {
            if(this.currentProductionState == ProductionState.None) {
                this.currentProductionState = ProductionState.WaitForMakiIngredient;

                stageManager.choppingBlock_sprite.spriteId = stageManager.choppingBlock_sprite.GetSpriteIdByName("choppingBlock_maki");
            }
        }
        else if(nameInput == Pickles) {
            if(this.currentProductionState == ProductionState.WaitForMakiIngredient) {
                if(sushi_rice_solution == null && sushi == null) {
                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + "PicklingCucumberFilledMaki_anim", typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = stageManager.choppingBlock_sprite.transform.position;
                    stageManager.choppingBlock_sprite.gameObject.active = false;

                    tk2dAnimatedSprite new_maki_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    new_maki_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId) {
                        Destroy(sushi_rice_solution);
                        stageManager.choppingBlock_sprite.gameObject.active = true;
                        stageManager.choppingBlock_sprite.spriteId = stageManager.choppingBlock_sprite.GetSpriteIdByName("choppingBlock");

                        GameObject maki_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        maki_product_obj.transform.position = new Vector3(0, -44, -2);
                        maki_product_obj.name = GoodDataStore.FoodMenuList.Pickling_cucumber_filled_maki.ToString();

                        sushi = maki_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Pickling_cucumber_filled_maki].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Pickling_cucumber_filled_maki.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;

                        this.currentProductionState = ProductionState.CompleteProduction;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[6]);
                }
            }
            else {
                stageManager.WarningPlayerToSeeManual();
            }
        }
        else if(nameInput == FlyingFishRoe) {
            if(this.currentProductionState == ProductionState.WaitForMakiIngredient) {
                if (sushi_rice_solution == null && sushi == null)
                {
                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + "PrawnBrownMaki_anim", typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = stageManager.choppingBlock_sprite.transform.position;
                    stageManager.choppingBlock_sprite.gameObject.active = false;

                    tk2dAnimatedSprite new_maki_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    new_maki_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);
                        stageManager.choppingBlock_sprite.gameObject.active = true;
                        stageManager.choppingBlock_sprite.spriteId = stageManager.choppingBlock_sprite.GetSpriteIdByName("choppingBlock");

                        GameObject maki_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        maki_product_obj.transform.position = new Vector3(0, -44, -2);
                        maki_product_obj.name = GoodDataStore.FoodMenuList.Prawn_brown_maki.ToString();

                        sushi = maki_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Prawn_brown_maki].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Prawn_brown_maki.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;

                        this.currentProductionState = ProductionState.CompleteProduction;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[6]);
                }
            }
            else {
                stageManager.WarningPlayerToSeeManual();
            }
        }
        else if(nameInput == Roe) {
            if (this.currentProductionState == ProductionState.WaitForMakiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + "RoeMaki_anim", typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = stageManager.choppingBlock_sprite.transform.position;
                    stageManager.choppingBlock_sprite.gameObject.active = false;

                    tk2dAnimatedSprite new_maki_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    new_maki_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);
                        stageManager.choppingBlock_sprite.gameObject.active = true;
                        stageManager.choppingBlock_sprite.spriteId = stageManager.choppingBlock_sprite.GetSpriteIdByName("choppingBlock");

                        GameObject maki_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        maki_product_obj.transform.position = new Vector3(0, -44, -2);
                        maki_product_obj.name = GoodDataStore.FoodMenuList.Roe_maki.ToString();

                        sushi = maki_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Roe_maki].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Roe_maki.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;

                        this.currentProductionState = ProductionState.CompleteProduction;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[6]);
                }
            }
            else {
                stageManager.WarningPlayerToSeeManual();
            }
        }

        if(nameInput == Crab_sushi_face)
        {
            #region <!-- Crab_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient) {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + CrabSushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId) {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Crab_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Crab_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Crab_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if(nameInput == Eel_sushi_face)
        {
            #region <!-- Eel_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient) {
                if(sushi_rice_solution == null && sushi == null) {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Eel_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId) {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Eel_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Eel_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Eel_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Fatty_tuna_sushi_face)
        {
            #region <!-- Fatty_tuna_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Fatty_tuna_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Fatty_tuna_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Fatty_tuna_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Fatty_tuna_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Octopus_sushi_face)
        {
            #region <!-- Octopus_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Octopus_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Octopus_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Octopus_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Octopus_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Prawn_sushi_face)
        {
            #region <!-- Prawn_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Prawn_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Prawn_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Prawn_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Prawn_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Salmon_sushi_face)
        {
            #region <!-- Salmon_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Salmon_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Salmon_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Salmon_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Salmon_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Skipjack_tuna_sushi_face)
        {
            #region <!-- Skipjack_tuna_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Skipjack_tuna_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Skipjack_tuna_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Skipjack_tuna_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Skipjack_tuna_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Spicy_shell_sushi_face)
        {
            #region <!-- Spicy_shell_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Spicy_shell_sushi_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Spicy_shell_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Spicy_shell_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Spicy_shell_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
        else if (nameInput == Sweetened_egg_sushi_face)
        {
            #region <!-- Sweetened_egg_sushi_face.

            if (this.currentProductionState == ProductionState.WaitForSushiIngredient)
            {
                if (sushi_rice_solution == null && sushi == null)
                {
                    this.currentProductionState = ProductionState.CompleteProduction;

                    this.sushiPopup.gameObject.SetActiveRecursively(false);
                    Destroy(sushiRice.gameObject);

                    sushi_rice_solution = Instantiate(Resources.Load("FoodSolution/" + Sweetened_egg_anim, typeof(GameObject))) as GameObject;
                    sushi_rice_solution.transform.position = new Vector3(0, -25, -2);

                    tk2dAnimatedSprite sushi_rice_anim = sushi_rice_solution.GetComponent<tk2dAnimatedSprite>();
                    sushi_rice_anim.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
                    {
                        Destroy(sushi_rice_solution);

                        GameObject sushi_product_obj = Instantiate(Resources.Load(PATH_OF_Sushi_product, typeof(GameObject))) as GameObject;
                        sushi_product_obj.transform.position = new Vector3(0, -44, -2);
                        sushi_product_obj.name = GoodDataStore.FoodMenuList.Sweetened_egg_sushi.ToString();

                        sushi = sushi_product_obj.GetComponent<GoodsBeh>();
                        sushi.costs = stageManager.goodDataStore.FoodDatabase_list[(int)GoodDataStore.FoodMenuList.Sweetened_egg_sushi].costs;
                        sushi._canDragaable = true;
                        sushi.sprite.spriteId = sushi.sprite.GetSpriteIdByName(GoodDataStore.FoodMenuList.Sweetened_egg_sushi.ToString());
                        sushi.GoodsBeh_putObjectOnTray_Event = Handle_SushiBeh_putObjectOnTray_Event;
                        sushi.ObjectsBeh_destroyObj_Event = Handle_SushiBeh_destroyObj_Event;
                    };
                    // Play sound effect.
                    baseScene.audioEffect.PlayOnecSound(baseScene.soundEffect_clips[3]);
                }
            }
            else
            {
                stageManager.WarningPlayerToSeeManual();
                this.sushiPopup.SetActiveRecursively(false);
            }

            #endregion
        }
    }
Esempio n. 28
0
 public virtual void StartProduction()
 {
     productionStartTime = DateTime.UtcNow.ToUnixTime();
     ProductionState     = ProductionState.Production;
 }
Esempio n. 29
0
 public void RestartProduction()
 {
     ProductionState = ProductionState.OnGoing;
 }
Esempio n. 30
0
 public NaiveController(ProductionState state) : base(state)
 {
 }
Esempio n. 31
0
 public NaiveAsyncControllerWithHalfCycleDelay(ProductionState state) : base(state)
 {
 }
Esempio n. 32
0
 public override void Build()
 {
     constructionStartTime = DateTime.UtcNow.ToUnixTime();
     ProductionState       = ProductionState.Construct;
 }
Esempio n. 33
0
    private void Handle_SushiBeh_destroyObj_Event(object sender, EventArgs e)
    {
        GoodsBeh goods = sender as GoodsBeh;
        Mz_StorageManage.AvailableMoney -= goods.costs;
        stageManager.CreateDeductionsCoin (goods.costs);
        stageManager.ReFreshAvailableMoney();
        stageManager.foodTrayBeh.goodsOnTray_List.Remove(goods);
        stageManager.foodTrayBeh.ReCalculatatePositionOfGoods();

        this.currentProductionState = ProductionState.None;
    }