// Update is called once per frame
    void Update()
    {
        if (digit1 != null && digit2 != null)
        {
            this.digit1.color  = this.color;
            this.digit2.color  = this.color;
            this.digit1.number = this.counter / 10;
            this.digit2.number = this.counter % 10;
        }

        if (this.trafficLight != null)
        {
            this.trafficLight.color = this.color;
        }
    }
    private void DecreaseCounter()
    {
        if (this.counter == this.timer)
        {
            EventManager.TriggerEvent(this.gameObject, EventManager.FormateEventName(this.gameObject, TrafficColor.Type.Car.ToString(), this.color.ToString()));
            EventManager.TriggerEvent(this.gameObject, EventManager.FormateEventName(this.gameObject, TrafficColor.Type.Human.ToString(), TrafficColor.getOppisit(this.color).ToString()));
            if (this.color.Equals(TrafficColor.Color.Green))
            {
                this.wall.enabled = false;
            }
            else if (this.color.Equals(TrafficColor.Color.Red))
            {
                this.wall.enabled = true;
            }
        }

        if (this.counter > 0)
        {
            this.counter = this.counter - 1;
        }
        else
        {
            TrafficColor.Color temp = this.color;
            this.color    = TrafficColor.getNext(this.color, this.oldColor);
            this.oldColor = temp;


            if (TrafficColor.Color.Yellow.Equals(this.color))
            {
                this.counter = this.switchTimer;
            }
            else
            {
                this.counter = this.timer;
            }
        }
    }