Ejemplo n.º 1
0
    //CREATE A METHOD TO SHIFT DOWN ALL DATA BUT PRIOR TO THAT REMOVE ALL BOUNDS BOUNDS CHANGE BASED OFF NEW X AND YS

    public void OnBlockCreation()
    {
        //if bottom of block not hit keep block falling

        //text moving relative to canvas

        //

        movementSound = GetComponents <AudioSource>()[0];
        blocksOnMap   = FindObjectsOfType <Block>();

        datamanager  = FindObjectOfType <Datamanager>();
        spriteRender = GetComponent <SpriteRenderer>();

        var pos = new Vector3(6.6f, 10.74f, blockZValue);


        transform.position = pos;


        var sign = datamanager.PullSign();


        var equation = datamanager.PullEquation();

        datamanager.SetUpcomingText(UpComingText);
        var num1Str = equation[0].ToString();
        var num2Str = equation[1].ToString();
        var spaces  = datamanager.PositionTextBasedOffEquation(num1Str.Length + num2Str.Length);

        equationText.text = spaces + equation[0] + sign + equation[1];

        solution = datamanager.ComputeSolution(equation[0], equation[1], sign);
        var blockColor = allBocks[Random.Range(0, 10)];

        var BlockColorNameSplit = blockColor.name.Split('_');
        var rgbValues           = PickParticleColor(BlockColorNameSplit[BlockColorNameSplit.Length - 1]);

        spriteRender.sprite = blockColor;



        var system = particules.GetComponent <ParticleSystem>();

        var sysMain = system.main;


        sysMain.startColor = new Color(rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3]);



        color     = spriteRender.color;
        textColor = equationText.color;


        active = true;
    }