Пример #1
0
    void ChangePip()
    {
        if (filled)
        {
            if (district.Equals("h1") && districtMan.districts[0].DecrementResource(resource))
            {
                //filled = !filled;
                filled     = false;
                img.sprite = off;
                resResource.IncrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("h2") && districtMan.districts[1].DecrementResource(resource))
            {
                //filled = !filled;
                filled     = false;
                img.sprite = off;
                resResource.IncrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("i1") && districtMan.districts[2].DecrementResource(resource))
            {
                //filled = !filled;
                filled     = false;
                img.sprite = off;
                resResource.IncrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("i2") && districtMan.districts[3].DecrementResource(resource))
            {
                //filled = !filled;
                filled     = false;
                img.sprite = off;
                resResource.IncrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else
            {
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 1f);
            }

            //filled = false;
        }
        else if (!filled && resResource.GetTotalPips() > 0)
        {
            if (district.Equals("h1") && districtMan.districts[0].IncrementResource(resource))
            {
                //filled = !filled;
                filled     = true;
                img.sprite = on;
                resResource.DecrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("h2") && districtMan.districts[1].IncrementResource(resource))
            {
                //filled = !filled;
                filled     = true;
                img.sprite = on;
                resResource.DecrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("i1") && districtMan.districts[2].IncrementResource(resource))
            {
                //filled = !filled;
                filled     = true;
                img.sprite = on;
                resResource.DecrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else if (district.Equals("i2") && districtMan.districts[3].IncrementResource(resource))
            {
                //filled = !filled;
                filled     = true;
                img.sprite = on;
                resResource.DecrementPips();
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 0f);
            }
            else
            {
                warning.color = new Color(warning.color.r, warning.color.g, warning.color.b, 1f);
            }
            //filled = !filled;
            //resResource.DecrementPips();
        }
        //print(districtMan.districts[0].GetResource(resource));
        //print(pipNum);
    }