Пример #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        ZoneBehaviour zoneBehaviour = transform.parent.parent.GetComponent <ZoneBehaviour>();
        float         timer         = zoneBehaviour.captureTimer;
        float         maxTimer      = zoneBehaviour.captureDuration;
        int           teamInArea    = zoneBehaviour.getTeamInArea();

        if (timer == .0f)
        {
            width = .0f;
        }
        else
        {
            width  = timer / maxTimer;
            width  = 1 - width;
            width *= maxWidth;
        }

        if (width < .0f)
        {
            width = .0f;
        }
        if (width > maxWidth)
        {
            width = maxWidth;
        }

        rt.sizeDelta = new Vector2(width, maxHeight);

        setUIColor(teamInArea);
    }