Ejemplo n.º 1
0
        void Awake()
        {
            sceneNavigator = SceneNavigationManager.Instance;

            screens = new List <UI.Screen>()
            {
                menuScreen,
                levelSelectionScreen,
                gameScreen,
                endGameScreen,
                instructionsScreen,
                loadingScreen
            };

            gameScreen.SetData(() => EndGame(false));
            endGameScreen.SetData(RestartGame, () => LoadMenu(true));
            menuScreen.SetData(ExitGame, () => ShowScreen(instructionsScreen), () => ShowScreen(levelSelectionScreen));
            instructionsScreen.SetData(ShowMenuScreen);
            levelSelectionScreen.SetData(
                Factory.TankFactory.Instance.GetTypes(),
                sceneNavigator.LevelScenes,
                (type, level) =>
            {
                selectedTankType = type;
                LoadLevel(level);
            },
                ShowMenuScreen);
        }
Ejemplo n.º 2
0
        private void Update()
        {
            if (timer <= 0)
            {
                return;
            }

            timer -= Time.deltaTime;

            gameScreen.SetData(fortress.HealthFraction, score, timer, kills, coins);
            unitsShopScreen.SetData(coins, fortress.CanPlaceUnit);

            if (timer <= 0)
            {
                Win();
            }
        }