Exemple #1
0
//Disable all turrets on rotate, then recheck each side for matches.
//Activate turrets based on number of Match-3s on a given side.
    void Activator()
    {
        //Find each block in the runway and effect changes on that block's children (turrets)
        GridInUse[] runway = FindObjectsOfType(typeof(GridInUse)) as GridInUse[];
        foreach (GridInUse child in runway)
        {
            TurretController childTwo = child.GetComponentInChildren <TurretController>();
            if (childTwo != null)
            {
                childTwo.isActivated = false;
                if (child.transform.localPosition.x > 0 && child.transform.localPosition.x <= (Mathf.CeilToInt(greenValue.sliderValue / 5)) * 2)
                {
                    childTwo.SetTurretActive("GreenTurret");
                }

                if (child.transform.localPosition.x > 0 && child.transform.localPosition.x <= (Mathf.CeilToInt(redValue.sliderValue / 5)) * 2)
                {
                    childTwo.SetTurretActive("RedTurret");
                }

                if (child.transform.localPosition.x > 0 && child.transform.localPosition.x <= (Mathf.CeilToInt(blueValue.sliderValue / 5)) * 2)
                {
                    childTwo.SetTurretActive("BlueTurret");
                }
            }
        }
    }