Пример #1
0
    public override void _Ready()
    {
        lever            = GetNode <Sprite>("Lever");
        endCurvePosition = lever.GetNode <Position2D>("Position2D");

        mainPath = GetNode <Path2D>("MainPath");

        global = GetNode <Global>("/root/Global");

        if (global.colorsData.Count < 6)
        {
            global.colorsData.Clear();
            global.AddData(global.colorsData);
        }

        if (global.unusedColorsData.Count <= 6)
        {
            global.unusedColorsData.Clear();
            global.AddData(global.unusedColorsData);
        }

        if (global.spawnColorsData.Count >= 0)
        {
            global.spawnColorsData.Clear();
            global.AddSpawnColorsData();
        }

        GD.Print("startover");

        global.setCount = 1;
        global.StartWaveTimer();
    }
Пример #2
0
    public override void _Ready()
    {
        leftLever  = GetNode <Sprite>("LeverLeft");
        rightLever = GetNode <Sprite>("LeverRight");

        mainPathLeft  = GetNode <Path2D>("MainPathLeft");
        mainPathRight = GetNode <Path2D>("MainPathRight");

        leftTimer  = GetNode <Timer>("LeftTimer");
        rightTimer = GetNode <Timer>("RightTimer");

        global = GetNode <Global>("/root/Global");

        GD.Randomize();

        if (global.colorsData.Count < 6)
        {
            global.colorsData.Clear();
            global.AddData(global.colorsData);
        }

        if (global.unusedColorsData.Count <= 6)
        {
            global.unusedColorsData.Clear();
            global.AddData(global.unusedColorsData);
        }

        if (global.spawnColorsData_Left.Count >= 0)
        {
            global.spawnColorsData_Left.Clear();
            global.AddSpawnColorsData("Left");
        }

        if (global.spawnColorsData_Right.Count >= 0)
        {
            global.spawnColorsData_Right.Clear();
            global.AddSpawnColorsData("Right");
        }

        if (global.midColors.Count >= 0)
        {
            global.midColors.Clear();
        }

        int rand = (int)GD.RandRange(0, 10);

        if (rand < 4)
        {
            leftTimer.Start();
            global.firstLeft = true;
        }
        else
        {
            rightTimer.Start();
            global.firstLeft = false;
        }

        GD.Print("startover");

        global.setCount = 1;
        global.StartWaveTimer();
    }