Esempio n. 1
0
        public override void StartApp()
        {
            GenerateLevel();
            Sprite sRocket    = gm.spriteDB.speedRunner_rocket;
            Sprite sSpeedMark = gm.spriteDB.speedRunner_rocketSpeedMark;
            Sprite sAsteroid  = gm.spriteDB.speedRunner_rocketAsteroid;
            Sprite sExplosion = gm.spriteDB.speedRunner_rocketExplosion;
            Sprite sFinish    = gm.spriteDB.speedRunner_rocketFinish;

            ScreenElement.BuildRectangle("Line", Parent).SetSize(1, 32).SetPosition(6, 0);
            rocket = ScreenElement.BuildSprite("Rocket", Parent).SetSize(8, 8).SetPosition(15, 32).SetSprite(sRocket);
            StartCoroutine(IASpawnRocket());

            for (int i = 0; i < visualRows.Length; i++)
            {
                visualRows[i] = ScreenElement.BuildContainer($"Row{i}", Parent).SetSize(24, 6).SetPosition(7, -6);
                for (int j = 0; j < 3; j++)
                {
                    ScreenElement.BuildSprite($"Asteroid{j}", visualRows[i].transform).SetSize(7, 6).SetPosition(j * 8, 0).SetSprite(sAsteroid);
                }
            }
            finishRow = ScreenElement.BuildContainer($"FinishRow", Parent).SetSize(25, 32).SetPosition(7, -32);
            for (int i = 0; i < 2; i++)
            {
                ScreenElement.BuildSprite($"FinishLine{i}", finishRow.transform).SetSize(6, 32).SetPosition(1 + (i * 17), 0).SetSprite(sFinish);
            }
            for (int i = 0; i < speedMarks.Length; i++)
            {
                speedMarks[i] = ScreenElement.BuildSprite($"SpeedMark{i}", Parent).SetSize(3, 5).SetPosition(2, 26 - (i * 6)).SetSprite(sSpeedMark);
                speedMarks[i].SetActive(false);
            }
            InvokeRepeating("CustomUpdate", 0f, THIS_DELTA_TIME);
        }