Пример #1
0
 private void CountBreakableBlocks()
 {
     if (tag == "Breakable")
     {
         level.AddBlock();
     }
 }
Пример #2
0
 private void Start()
 {
     level      = FindObjectOfType <Level>();
     gameStatus = FindObjectOfType <GameSession>();
     powerUps   = FindObjectOfType <PowerUps>();
     level.AddBlock();
 }
Пример #3
0
 private void CountBreakableBlocks()
 {
     level = FindObjectOfType <Level>();
     if (tag == "Breakable")
     {
         level.AddBlock();
     }
 }
Пример #4
0
 private void CountBreakableBlocks()
 {
     level = FindObjectOfType <Level>();
     if (CompareTag(BlockTag.Breakable))
     {
         level.AddBlock();
     }
 }
Пример #5
0
 private void Start()
 {
     if (tag == "Unbreakable")
     {
         return;
     }
     _level = FindObjectOfType <Level>();
     _level.AddBlock();
 }
Пример #6
0
    /* AddBlockToLevel checks to see if the block is breakable.
     * If true, it caches references to the Level and Game State game objects.
     * It then calls a public method in Level to add itself to the block count.
     */
    private void AddBlockToLevel()
    {
        if (CompareTag("Breakable"))
        {
            level     = FindObjectOfType <Level>();
            gameState = FindObjectOfType <GameState>();

            level.AddBlock();
        }
    }
Пример #7
0
    private void CountBreakableBlocks()
    {
        level = FindObjectOfType <Level>();

        // Only keep track of breakable blocks to proceed to the next level
        if (tag == "Breakable")
        {
            level.AddBlock();
        }
    }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        gameLevel        = FindObjectOfType <Level>();
        gameState        = FindObjectOfType <GameStatus>();
        numberOfTimesHit = 0;

        if (tag == "Breakable")
        {
            gameLevel.AddBlock();
        }
    }
Пример #9
0
    private void Start()
    {
        level     = FindObjectOfType <Level>();
        gameState = FindObjectOfType <GameState>();

        // Only counting breakable blocks
        if (tag == "Breakable")
        {
            level.AddBlock();
        }
    }
Пример #10
0
 void Start()
 {
     gameStatus = GameObject.FindWithTag("GameStatus").GetComponent <GameStatus>();
     // https://docs.unity3d.com/2021.1/Documentation/ScriptReference/GameObject.Find.html
     level = GameObject.FindWithTag("Level").GetComponent <Level>();
     if (tag == "Breakable")
     {
         spriteRenderer = GetComponent <SpriteRenderer>();
         level.AddBlock();
     }
 }
Пример #11
0
    void Start()
    {
        level        = FindObjectOfType <Level>();
        gameSession  = FindObjectOfType <GameSession>();
        cameraShake  = FindObjectOfType <CameraShake>();
        powerControl = FindObjectOfType <PowerControl>();
        baseColor    = GetComponent <SpriteRenderer>().color;

        if (breakable)
        {
            currentHP = baseHP = blockPhases.Length;
            level.AddBlock();
            CrackBlock();
        }
    }
Пример #12
0
 void AddDet(Vector3 position, int BlockId, int ColorID, GameObject Object)
 {
     Object.GetComponent <PaintBlockInfo>().ColorID = ColorID;
     Object.GetComponent <PaintBlockInfo>().Layer   = GameObjLayer;
     Object.transform.localScale = new Vector3(ScaleModule.ScaleModyfy, ScaleModule.ScaleModyfy, 1);
     Object.transform.localScale = new Vector3(Object.transform.localScale.x - 0.11f, Object.transform.localScale.y - 0.11f, 1);
     Object.GetComponent <PaintBlockInfo>().OriginX = position.x * 30;
     Object.GetComponent <PaintBlockInfo>().OriginY = position.y * 30;
     Instantiate(Object, position, Quaternion.identity);
     level.AddBlock(new DetailBlock(BlockId)
     {
         PositionX   = position.x * 30,
         PositionY   = position.y * 30,
         ColorDetail = Convert.ToInt16(ColorID),
         ZOrder      = (short)GameObjLayer,
         EditorL     = Convert.ToInt16(Layer),
         Scale       = Object.transform.localScale.x + 0.11f,
     });
 }
Пример #13
0
        static void Main(string[] args)
        {
            Console.Title = "Art To Geometry Dash";
            Welcome();
            Console.Write("Image path.\nExample: C:\\images\\my.png\n> ");
            fileArt = Console.ReadLine().Replace("\"", "");
            Console.Clear();
            Console.Write("Width and height pixel (pixels). \n> ");
            pixelSize = int.Parse(Console.ReadLine());
            Console.Clear();
            Console.Write("Alpha color.\nExample 1: 255 255 255 (Cut close to white color)\nExample 2: A 245 (Cuts all pixels with little aplha.)\n> ");
            string[] al = Console.ReadLine().Split(' ');
            if (al[0] == "A" || al[0] == "А")
            {
                useAplhaChannel = true;
                alphaChannel    = byte.Parse(al[1]);
            }
            else
            {
                alpha    = new byte[3];
                alpha[0] = byte.Parse(al[0]);
                alpha[1] = byte.Parse(al[1]);
                alpha[2] = byte.Parse(al[2]);
            }
            Console.Clear();
            Console.Write("Color similarity ratio.\n0 - Exact color match\nThe higher the value, the less color will be used in the level.\nRecommended value: 10\n> ");
            userDistance = double.Parse(Console.ReadLine());
            Console.Clear();
            Console.Write("What ID to start creating the palette\n> ");
            colorStart = int.Parse(Console.ReadLine());
            Console.Clear();
            Console.Write("The size of the art in the level.\n1: 1 pixel = 1/4 block\nExample: 0,8\n> ");
            scale = float.Parse(Console.ReadLine());
            Console.Clear();
            Console.Write("Image coordinates in level.\n1 block = 30, 2 block = 60\nTemplate: X Y\nExample: 2000 0\nUsing coordinates far from 0 when adding a large image, otherwise the level may not open.\n> ");
            string[] coords = Console.ReadLine().Split(' ');
            coordX = float.Parse(coords[0]);
            coordY = float.Parse(coords[1]);
            Console.Clear();
            Console.Write("Layer for art.\n> ");
            EditorLayer = int.Parse(Console.ReadLine());
            Console.Clear();
            Console.Write("Add a color changing trigger?\n1 - Yes\n0 - No\n> ");
            string addtrgstr = Console.ReadLine();

            addTrigger = addtrgstr.ToLower() == "yes" || addtrgstr == "1" ? true : false;
            Console.Clear();
            Console.Write("The name of the level in which the art will be placed.\nRecomended use empty level.\nPossible level damage!\n> ");
            levelName = Console.ReadLine();
            Console.Clear();

            Stopwatch sw = new Stopwatch();

            sw.Restart();

            Console.WriteLine("Loading level ...");
            localLevels = new LocalLevels();
            level       = new Level(localLevels.GetLevelByName(levelName), null, new List <int>());

            Console.WriteLine("Loading image ...");
            art = new Bitmap(fileArt);

            blockStart = level.CountBlock;

            Console.WriteLine("Creating art...");
            int currentColorID = colorStart;
            int startFor       = 0;

            if (pixelSize >= 2)
            {
                startFor = 1;
            }
            else if (pixelSize >= 4)
            {
                startFor = 2;
            }
            else if (pixelSize >= 8)
            {
                startFor = 4;
            }
            for (int x = startFor; x < art.Width; x += pixelSize)
            {
                for (int y = startFor; y < art.Height; y += pixelSize)
                {
                    System.Drawing.Color color = art.GetPixel(x, y);
                    int colorInt = BytesToInt(color.R, color.G, color.B);
                    if (useAplhaChannel)
                    {
                        if (color.A < alphaChannel)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (FindSimilar(color.R, color.G, color.B, alpha[0], alpha[1], alpha[2]))
                        {
                            continue;
                        }
                    }
                    if (!palette.ContainsKey(colorInt))
                    {
                        int?sim = FindSimilar(color.R, color.G, color.B);
                        if (sim == null)
                        {
                            level.AddColor(new GeometryDashAPI.Levels.Color((short)currentColorID, color.R, color.G, color.B));
                            palette.Add(colorInt, currentColorID);
                            if (addTrigger)
                            {
                                level.AddBlock(new PulseTrigger()
                                {
                                    TargetID  = currentColorID,
                                    Red       = color.R,
                                    Green     = color.G,
                                    Blue      = color.B,
                                    Hold      = 10f,
                                    PositionX = -15 + coordX,
                                    PositionY = 0 + coordY,
                                    EditorL   = (short)EditorLayer
                                });
                            }
                            currentColorID++;
                        }
                        else
                        {
                            colorInt = (int)sim;
                        }
                    }
                    DetailBlock block = new DetailBlock(917);
                    block.ColorDetail = (short)palette[colorInt];
                    block.Scale       = scale;
                    block.EditorL     = (short)EditorLayer;
                    block.PositionX   = (x / pixelSize * 7.5f * scale) + coordX;
                    block.PositionY   = ((art.Height - y) / pixelSize * 7.5f * scale) + coordY;
                    level.AddBlock(block);
                }
            }

            Console.WriteLine("Save...");
            localLevels.GetLevelByName(levelName).LevelString = level.ToString();
            localLevels.Save();

            sw.Stop();

            Console.Clear();
            Console.WriteLine($"Completed!\nUsed colors: {palette.Count}\nUsed blocks: {level.CountBlock - blockStart}\nElapsed time: {sw.ElapsedTicks} ticks ({sw.ElapsedMilliseconds} milliseconds)");
            Console.WriteLine("Press any button to continue.");
            Console.ReadKey();
        }
Пример #14
0
 private void Start()
 {
     level = FindObjectOfType <Level>();
     level.AddBlock();
 }
    public void InitiateLevels()
    {
        Levels = new List <Level>();
        Level tempLevel = new Level();

        #region Level 1

        //Landscape
        tempLevel.AddLandscape("Level1");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));

        //Blocks
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(10.21593f, -2.892341f), Quaternion.Euler(0, 0, 90.26701f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(-0.1401955f, -6.457932f), Quaternion.Euler(0, 0, 0.041f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(12.9698f, -6.392479f), Quaternion.Euler(0, 0, 0.155f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(2.149655f, -2.937033f), Quaternion.Euler(0, 0, 90.269f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(7.500449f, -6.418904f), Quaternion.Euler(0, 0, 0.09100001f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(4.529908f, -6.435939f), Quaternion.Euler(0, 0, 0.056f));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(2.22f, -8.89f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(9.278996f, -8.77f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(10.33f, -1.57f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion

        #region Level 2
        tempLevel = new Level();
        //Landscape
        tempLevel.AddLandscape("Level2");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));

        //Blocks
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(3.793869f, -3.62f), Quaternion.Euler(0, 0, 0));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(12.51774f, 1.16f), Quaternion.Euler(0, 0, 0));
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(20.29699f, 5.72f), Quaternion.Euler(0, 0, 0));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(5.139043f, -6.091519f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(7.699126f, -6.091519f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(6.405476f, -6.091519f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(13.56967f, -0.9713382f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(15.12935f, -1.01f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(22.2418f, 3.772467f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion

        #region Level 3
        tempLevel = new Level();
        //Landscape
        tempLevel.AddLandscape("Level3");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));

        //Blocks
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(9.692039f, 3.819306f), Quaternion.Euler(0, 0, 80.50301f));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(-4.62f, 7.05f), Quaternion.Euler(0, 0, -102.658f));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(-5.89189f, 8.407306f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(-4.7099f, 8.111808f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(-3.593577f, 7.947642f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(-2.345921f, 7.652145f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(10.82321f, 4.816171f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(12.08969f, 4.881282f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion

        #region Level 4
        tempLevel = new Level();
        //Landscape
        tempLevel.AddLandscape("Level4");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));
        //Blocks
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(18.38663f, 5.199508f), Quaternion.Euler(0, 0, -0.476f));
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(13.26352f, 3.227602f), Quaternion.Euler(0, 0, 0.7820001f));
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(1.819896f, 3.539904f), Quaternion.Euler(0, 0, 91.31001f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(12.52407f, 6.404523f), Quaternion.Euler(0, 0, -2.081f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(15.94847f, 7.884973f), Quaternion.Euler(0, 0, -68.382f));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(-6.999947f, -0.2677824f), Quaternion.Euler(0, 0, -0.029f));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(-0.2620025f, -0.02361375f), Quaternion.Euler(0, 0, 1.303f));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(3.830903f, 0.06998272f), Quaternion.Euler(0, 0, 1.32f));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(2.310153f, -2.369045f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(0.85f, -2.369045f));
        tempLevel.AddMeat(Meats[0].Clone(), new Vector2(16.87f, 3.9f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(-3.691193f, -4.565026f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(15.1f, 4.3f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion

        #region Level 5
        tempLevel = new Level();
        //Landscape
        tempLevel.AddLandscape("Level5");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));

        //Blocks
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(3.822095f, 2.73f), Quaternion.Euler(0, 0, 0));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(4.561045f, 2.75f), Quaternion.Euler(0, 0, 0));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(16.7f, -7.1f), Quaternion.Euler(0, 0, 0));
        tempLevel.AddBlock(Blocks[2].Clone(), new Vector2(5.3f, 2.73f), Quaternion.Euler(0, 0, 0));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(18.55424f, -0.5403616f));
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(18.92f, -8.62f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(20.98222f, -8.4f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion

        #region Level 6
        tempLevel = new Level();
        //Landscape
        tempLevel.AddLandscape("Level6");

        //Catapult Position
        tempLevel.SetCatapultPosition(new Vector2(-15.79f, -1.75f));

        //Blocks
        tempLevel.AddBlock(Blocks[0].Clone(), new Vector2(-0.8759069f, -2.033174f), Quaternion.Euler(0, 0, 1.426f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(8.283579f, -0.7703575f), Quaternion.Euler(0, 0, -1.76f));
        tempLevel.AddBlock(Blocks[1].Clone(), new Vector2(15.42211f, -3.155972f), Quaternion.Euler(0, 0, 89.954f));

        //Music
        tempLevel.MusicTitle = "Dutty";

        //Scores
        tempLevel.ScoreForTwoStars   = 1180;
        tempLevel.ScoreForThreeStars = 1680;

        //Meat
        tempLevel.AddMeat(Meats[1].Clone(), new Vector2(1.54935f, -4.505739f));
        tempLevel.AddMeat(Meats[2].Clone(), new Vector2(8.087934f, -7.874353f));

        //Max Vegetables
        tempLevel.MaxVegetables = 6;

        Levels.Add(tempLevel);
        #endregion
    }