예제 #1
0
        public IEnumerator EndProject(bool positive)
        {
            _gameManager.AddTime(_maxProgress);

            if (positive)
            {
                _gameManager.CreateNewspaper("Project Finished", "Citizens very happy!", "Close", () => { });
            }
            else
            {
                string description = 100 + (double)_overBudget > 125 ? "Budget too high!" : "Architect decides to stop work";
                _gameManager.CreateNewspaper("Project Failed", description, "Close", () => { });
            }


            _maxProgress = 0;
            _gridHandler.FinishBuilding(positive);

            if (_gridHandler.TilesLeft() == 0)
            {
                GameObject.Find("GameManager").GetComponent <GameManager>().IsGameEnded = true;
                _gridHandler.InstantiateVictory();
            }

            _projectCardManager.CurrentProject = null;
            _projectCardManager.HasGenerated   = false;

            GetComponent <Animator>().SetTrigger("PopUp");
            yield return(new WaitForSeconds(1));

            //TODO SHOW ENDING SCREEN
            Destroy(gameObject);
        }