Beispiel #1
0
        private IEnumerator IAElevateRocket()
        {
            gm.LockInput();

            for (int i = 0; i < 32; i++)
            {
                rocket.Move(Direction.Up);
                yield return(new WaitForSeconds(1.5f / 32));
            }
            foreach (SpriteBuilder sb in speedMarks)
            {
                sb.SetActive(false);
            }
            finishRow.SetActive(false);

            yield return(new WaitForSeconds(0.5f));

            TextBoxBuilder tbGoal = ScreenElement.BuildTextBox("Goal", Parent, DFont.Small).SetText("GOAL!").SetSize(24, 5).SetPosition(9, 8);

            yield return(new WaitForSeconds(0.5f));

            currentScreen = 1;
            gm.UnlockInput();
            while (true)
            {
                tbGoal.SetActive(!tbGoal.Active);
                yield return(new WaitForSeconds(0.5f));
            }
        }
Beispiel #2
0
        private IEnumerator CountDown()
        {
            while (!gameStarted)
            {
                yield return(new WaitForSeconds(0.05f));
            }
            yield return(new WaitForSeconds(1f));

            while (timeRemaining > 0)
            {
                if (this == null)
                {
                    yield break;
                }
                timeRemaining--;
                tbTime.Text = timeRemaining.ToString();
                yield return(new WaitForSeconds(1f));
            }

            timeRemaining = -1;
            audioMgr.PlaySound(audioMgr.speedRunner_Finish);
            yield return(new WaitForSeconds(1.5f));

            timeRemaining = -2;

            foreach (var sb in sbFaces)
            {
                sb.Dispose();
            }

            TextBoxBuilder tb = ScreenElement.BuildTextBox("End", screenDisplay.transform, DFont.Small).SetText("END").SetPosition(6, 17);
        }
Beispiel #3
0
        private IEnumerator IASpawnRocket(float delay = 0f)
        {
            yield return(new WaitForSeconds(delay));

            audioMgr.PlaySound(audioMgr.speedRunner_Start);

            rocket.SetPosition(15, 32);
            rocket.SetSprite(gm.spriteDB.speedRunner_rocket);

            for (int i = 0; i < 8; i++)
            {
                yield return(new WaitForSeconds(1f / 8));

                rocket.Move(Direction.Up);
            }
            TextBoxBuilder tbStart = ScreenElement.BuildTextBox("Start", Parent, DFont.Small).SetText("START").SetSize(24, 5).SetPosition(9, 8);

            yield return(new WaitForSeconds(0.5f));

            tbStart.SetActive(false);
            yield return(new WaitForSeconds(0.5f));

            tbStart.SetActive(true);
            yield return(new WaitForSeconds(1f));

            tbStart.SetActive(false);
            gameStarted = true;
        }
Beispiel #4
0
        private void OpenAreaSelection()
        {
            currentScreen = 1;
            //If the player is entering the map he already is in, start hovering in his current area, rather than the 'area 0' of that map.
            displayArea = (displayMap == originalMap) ? OriginalAreaIndexInCurrentMap : 0;

            if (currentAreaMarker != null)
            {
                currentAreaMarker.SetActive(false);
            }

            //The marker that indicates the area that is being chosen.
            hoveredMarker = ScreenElement.BuildRectangle("OptionMarker", screenDisplay.transform).SetSize(2, 2).SetFlickPeriod(0.25f)
                            .SetPosition(thisWorldData.areas[SelectedArea].coords);
            hoveredAreaName = ScreenElement.BuildTextBox("AreaName", screenDisplay.transform, DFont.Small).SetText("area").SetPosition(28, 5);

            if (displayMap == 0 || displayMap == 3)
            {
                hoveredAreaName.SetPosition(2, 1);
            }
            else
            {
                hoveredAreaName.SetPosition(2, 26);
            }

            hoveredAreaName.Text = string.Format("area{0:00}", SelectedArea + 1); //+1 because, in game, areas start at #1, not 0.
        }
Beispiel #5
0
        private void DrawScreen()
        {
            ClearScreen();

            switch (currentScreen)
            {
            case 0:
                screenDisplay.sprite = gm.spriteDB.status_distance;
                string distance = gm.WorldMgr.CurrentDistance.ToString();
                string steps    = gm.WorldMgr.TotalSteps.ToString();
                ScreenElement.BuildTextBox("TextDistance", screenDisplay.transform, DFont.Regular)
                .SetText(distance).SetSize(31, 5).SetPosition(0, 10).SetAlignment(TextAnchor.UpperRight);
                ScreenElement.BuildTextBox("TextSteps", screenDisplay.transform, DFont.Regular)
                .SetText(steps).SetSize(31, 5).SetPosition(0, 26).SetAlignment(TextAnchor.UpperRight);
                break;

            case 1:
                screenDisplay.sprite = gm.spriteDB.status_level;
                string level   = gm.logicMgr.GetPlayerLevel().ToString();
                string spirits = gm.logicMgr.SpiritPower.ToString();
                ScreenElement.BuildTextBox("TextLevel", screenDisplay.transform, DFont.Regular)
                .SetText(level).SetSize(31, 5).SetPosition(0, 10).SetAlignment(TextAnchor.UpperRight);
                ScreenElement.BuildTextBox("TextSpirits", screenDisplay.transform, DFont.Regular)
                .SetText(spirits).SetSize(31, 5).SetPosition(0, 26).SetAlignment(TextAnchor.UpperRight);
                break;

            case 2:
                screenDisplay.sprite = gm.spriteDB.status_victories;
                float fVictoryPerc = gm.logicMgr.WinPercentage;
                int   iVictoryPerc = Mathf.RoundToInt(gm.logicMgr.WinPercentage * 100);
                //The victory percentage is never 100% or 0%, unless the player has won or lost every single battle they've played.
                if (iVictoryPerc == 100 && fVictoryPerc != 1f)
                {
                    iVictoryPerc = 99;
                }
                if (iVictoryPerc == 0 && fVictoryPerc != 0f)
                {
                    iVictoryPerc = 1;
                }

                string victoryPerc = iVictoryPerc.ToString();
                string winCount    = gm.logicMgr.TotalWins.ToString();
                ScreenElement.BuildTextBox("TextLevel", screenDisplay.transform, DFont.Regular)
                .SetText(victoryPerc).SetSize(24, 5).SetPosition(0, 10).SetAlignment(TextAnchor.UpperRight);
                ScreenElement.BuildTextBox("TextSpirits", screenDisplay.transform, DFont.Regular)
                .SetText(winCount).SetSize(31, 5).SetPosition(0, 26).SetAlignment(TextAnchor.UpperRight);
                break;

            case 3:
            case 4:
            case 5:
            case 6:
                int ddockNumber = currentScreen - 3;
                gm.GetDDockScreenElement(ddockNumber, screenDisplay.transform);
                break;
            }
        }
Beispiel #6
0
 public override void StartApp()
 {
     for (int i = 0; i < 5; i++)
     {
         underscores[i] = ScreenElement.BuildRectangle($"Underscore{i}", screenDisplay.transform).SetSize(5, 1).SetPosition(2 + (6 * i), 25);
     }
     selectedInputDisplay = ScreenElement.BuildTextBox("Input", screenDisplay.transform, DFont.Big).SetSize(6, 8).SetPosition(14, 8);
     currentInputDisplay  = ScreenElement.BuildTextBox("CurrentCode", screenDisplay.transform, DFont.Big).SetSize(30, 8).SetPosition(2, 17);
     UpdateScreen();
 }
Beispiel #7
0
        private void OpenViewDistance()
        {
            currentScreen = 2;
            //If the area chosen is the area the player is already in, the distance will not change. Otherwise, get the distance for the new area.

            int areaDist = (SelectedArea == originalArea) ? gm.WorldMgr.CurrentDistance : thisWorldData.areas[SelectedArea].distance;

            distanceScreen = ScreenElement.BuildSprite("DistanceScreen", screenDisplay.transform).SetSprite(gm.spriteDB.map_distanceScreen);
            ScreenElement.BuildTextBox("Distance", distanceScreen.transform, DFont.Regular)
            .SetText(areaDist.ToString()).SetSize(25, 5).SetPosition(6, 25).SetAlignment(TextAnchor.UpperRight);
        }
Beispiel #8
0
        private IEnumerator PADisplayPattern()
        {
            gm.LockInput();

            keypad  = ScreenElement.BuildSprite("Keypad", Parent).SetSize(24, 24).Center().SetSprite(gm.spriteDB.jackpot_pad);
            keys[0] = ScreenElement.BuildSprite("Key Left", Parent).SetSize(8, 12).SetPosition(4, 10)
                      .SetSprite(gm.spriteDB.jackpot_keys[0]).SetTransparent(true).SetActive(false);
            keys[1] = ScreenElement.BuildSprite("Key Right", Parent).SetSize(8, 12).SetPosition(20, 10)
                      .SetSprite(gm.spriteDB.jackpot_keys[1]).SetTransparent(true).SetActive(false);
            keys[2] = ScreenElement.BuildSprite("Key Up", Parent).SetSize(12, 8).SetPosition(10, 4)
                      .SetSprite(gm.spriteDB.jackpot_keys[2]).SetTransparent(true).SetActive(false);
            keys[3] = ScreenElement.BuildSprite("Key Down", Parent).SetSize(12, 8).SetPosition(10, 20)
                      .SetSprite(gm.spriteDB.jackpot_keys[3]).SetTransparent(true).SetActive(false);

            SpriteBuilder hourglass = ScreenElement.BuildSprite("Hourglass", Parent).SetSprite(gm.spriteDB.hourglass);

            yield return(new WaitForSeconds(0.75f));

            hourglass.Dispose();

            for (int i = 0; i < pattern.Length; i++)
            {
                audioMgr.PlaySound(audioMgr.beepLow);
                keys[pattern[i]].SetActive(true);
                yield return(new WaitForSeconds(delay));

                keys[pattern[i]].SetActive(false);
            }

            //Black screen:
            RectangleBuilder rbBlackScreen = ScreenElement.BuildRectangle("BlackScreen0", Parent).SetSize(32, 32);
            SpriteBuilder    sbLoading     = ScreenElement.BuildSprite("Loading", Parent).SetSprite(gm.spriteDB.loading).PlaceOutside(Direction.Up);

            for (int i = 0; i < 64; i++)
            {
                sbLoading.Move(Direction.Down);
                yield return(new WaitForSeconds((delay * 2f) / 64));
            }
            rbBlackScreen.Dispose();
            sbLoading.Dispose();

            //Ready the player:
            keypad.Move(Direction.Down, 4);
            keys.Move(Direction.Down, 4);
            tbTime = ScreenElement.BuildTextBox("Time", screenDisplay.transform, DFont.Small)
                     .SetText("TIME").SetSize(18, 5).SetPosition(1, 1);
            tbTimeCount = ScreenElement.BuildTextBox("TimeCount", screenDisplay.transform, DFont.Small)
                          .SetText(timeRemaining.ToString()).SetSize(10, 5).SetPosition(22, 1);
            StartCoroutine(TimeCount());

            gm.UnlockInput();
        }
Beispiel #9
0
        private IEnumerator IALoseGame()
        {
            gm.LockInput();

            foreach (SpriteBuilder sb in speedMarks)
            {
                sb.SetActive(false);
            }
            finishRow.SetActive(false);

            yield return(new WaitForSeconds(0.5f));

            TextBoxBuilder tbStart = ScreenElement.BuildTextBox("Game Over", Parent, DFont.Small).SetText("GAME\nOVER").SetSize(24, 11).SetPosition(9, 8);

            yield return(new WaitForSeconds(0.5f));

            currentScreen = 1;
            gm.UnlockInput();
        }
Beispiel #10
0
        public override void StartApp()
        {
            gm.EnqueueAnimation(Animations.StartAppDigiHunter(mark => gameStarted = mark));

            ScreenElement.BuildTextBox("Time", screenDisplay.transform, DFont.Small).SetText("TIME").SetSize(18, 5).SetPosition(1, 0);
            tbTime = ScreenElement.BuildTextBox("TimeCount", screenDisplay.transform, DFont.Small).SetText(timeRemaining.ToString()).SetSize(10, 5).SetPosition(22, 0);

            sbArrows[0] = ScreenElement.BuildSprite("Y-Arrow", Parent).SetSize(3, 6).SetPosition(2, 9).SetSprite(gm.spriteDB.digiHunter_arrows[0]);
            sbArrows[1] = ScreenElement.BuildSprite("X-Arrow", Parent).SetSize(6, 3).SetPosition(6, 5).SetSprite(gm.spriteDB.digiHunter_arrows[1]);
            for (int y = 0; y < sbFaces.GetLength(0); y++)
            {
                for (int x = 0; x < sbFaces.GetLength(1); x++)
                {
                    sbFaces[y, x] = ScreenElement.BuildSprite("Face", Parent).SetSize(8, 8).SetPosition(5 + (x * 8), 8 + (y * 8)).SetSprite(gm.spriteDB.emptySprite);
                }
            }

            gm.StartCoroutine(CountDown());
            gm.StartCoroutine(GenerateFaces());
        }
Beispiel #11
0
        private void DrawScreen()
        {
            //Stop all coroutines, except if the digimon name sign has a value and we are still in the 'Pages' screen.
            if (!(digimonNameSign != null && currentScreen == ScreenDatabase.Pages))
            {
                if (screenAnimation != null)
                {
                    StopCoroutine(screenAnimation);
                }
            }
            //Destroy all children, except the ones called 'NameSign' if we are in the 'Pages' screen.
            foreach (Transform child in screenDisplay.transform)
            {
                if (!(currentScreen == ScreenDatabase.Pages && child.name == "NameSign"))
                {
                    Destroy(child.gameObject);
                }
            }

            if (currentScreen == ScreenDatabase.Menu)
            {
                screenDisplay.sprite = gm.spriteDB.database_sections[menuIndex];
            }
            else if (currentScreen == ScreenDatabase.Menu_Spirit)
            {
                if (SelectedElement < 10)
                {
                    screenDisplay.sprite = gm.spriteDB.elements[SelectedElement];
                }
                else
                {
                    screenDisplay.sprite = gm.spriteDB.database_spirit_fusion;
                }
            }
            else if (currentScreen == ScreenDatabase.Gallery)
            {
                string displayDigimon = galleryList[galleryIndex];
                digimonIsInDDock     = gm.IsInDock(displayDigimon);
                screenDisplay.sprite = (digimonIsInDDock) ? gm.spriteDB.invertedArrowsSmall : gm.spriteDB.arrowsSmall;

                Sprite spriteRegular = gm.spriteDB.GetDigimonSprite(displayDigimon, SpriteAction.Default);
                Sprite spriteAlt     = gm.spriteDB.GetDigimonSprite(displayDigimon, SpriteAction.Attack);

                if (digimonIsInDDock)
                {
                    spriteRegular = gm.spriteDB.GetInvertedSprite(spriteRegular);
                    spriteAlt     = gm.spriteDB.GetInvertedSprite(spriteAlt);
                }

                SpriteBuilder builder = ScreenElement.BuildSprite("DigimonDisplay", screenDisplay.transform).SetSize(24, 24).Center().SetSprite(spriteRegular);

                screenAnimation = StartCoroutine(AnimateSprite(builder, spriteRegular, spriteAlt));
            }
            else if (currentScreen == ScreenDatabase.Pages)
            {
                if (digimonNameSign == null)
                {
                    string         name        = string.Format("{0:000} {1}", pageDigimon.number, pageDigimon.name);
                    TextBoxBuilder nameBuilder = ScreenElement.BuildTextBox("NameSign", screenDisplay.transform, DFont.Big).SetText(name).SetSize(32, 7).SetPosition(32, 0);
                    nameBuilder.SetFitSizeToContent(true);
                    digimonNameSign = nameBuilder.gameObject;
                    screenAnimation = StartCoroutine(AnimateName(nameBuilder));
                }

                int playerLevel       = gm.logicMgr.GetPlayerLevel();
                int digimonExtraLevel = gm.logicMgr.GetDigimonExtraLevel(pageDigimon.name);
                int realLevel;

                MutableCombatStats stats;
                //If the Digimon is Spirit- or Armor-Stage.
                if (menuIndex == 5 || menuIndex == 6)
                {
                    realLevel = pageDigimon.GetBossLevel(playerLevel);
                    stats     = pageDigimon.GetBossStats(playerLevel);
                }
                else
                {
                    realLevel = pageDigimon.GetFriendlyLevel(digimonExtraLevel);
                    stats     = pageDigimon.GetFriendlyStats(digimonExtraLevel);
                }


                int element = (int)pageDigimon.element;

                if (pageIndex == 0)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[0];
                    ScreenElement.BuildTextBox("Level", screenDisplay.transform, DFont.Regular)
                    .SetText(realLevel.ToString()).SetSize(15, 5).SetPosition(16, 9).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("HP", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.HP.ToString()).SetSize(15, 5).SetPosition(16, 17).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildSprite("Element", screenDisplay.transform).SetSize(30, 5).SetPosition(1, 25).SetSprite(gm.spriteDB.elementNames[element]);
                }
                else if (pageIndex == 1)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[1];
                    ScreenElement.BuildTextBox("Energy", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.EN.ToString()).SetSize(15, 5).SetPosition(16, 9).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("Crush", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.CR.ToString()).SetSize(15, 5).SetPosition(16, 17).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("Ability", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.AB.ToString()).SetSize(15, 5).SetPosition(16, 25).SetAlignment(TextAnchor.UpperRight);
                }
                else if (pageIndex == 2)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[2];
                    ScreenElement.BuildTextBox("Code", screenDisplay.transform, DFont.Big)
                    .SetText(pageDigimon.code).SetSize(30, 8).SetPosition(2, 23).SetAlignment(TextAnchor.UpperRight);
                }
            }
            else if (currentScreen == ScreenDatabase.DDockList)
            {
                screenDisplay.sprite = gm.spriteDB.database_ddocks[ddockIndex];
            }
            else if (currentScreen == ScreenDatabase.DDockDisplay)
            {
                screenDisplay.sprite = gm.spriteDB.status_ddock[ddockIndex];
                gm.GetDDockScreenElement(ddockIndex, screenDisplay.transform);
            }
        }