Пример #1
0
    public IEnumerator CoShowImageforSeconds_OpacityChange(ImageSeconds _imageSeconds)
    {
        _imageSeconds.Image.gameObject.SetActive(true);
        m_RedAimTimer = 0;

        //Set the alpha of image 1
        Color alpha = _imageSeconds.Image.color;

        alpha.a = 1f;
        _imageSeconds.Image.color = alpha;

        while (true)
        {
            m_RedAimTimer += _imageSeconds.Seconds / 10f;

            alpha.a -= 0.1f;
            _imageSeconds.Image.color = alpha;

            if (m_RedAimTimer > _imageSeconds.Seconds)
            {
                _imageSeconds.Image.gameObject.SetActive(false);
                m_RedAimTimer = 0;
                StopCoroutine("CoShowImageforSeconds_OpacityChange");
            }

            yield return(new WaitForSeconds(_imageSeconds.Seconds / 10f));
        }
    }
Пример #2
0
    public IEnumerator CoShowImageforSeconds(ImageSeconds _imageSeconds)
    {
        _imageSeconds.Image.gameObject.SetActive(true);
        yield return(new WaitForSeconds(_imageSeconds.Seconds));

        _imageSeconds.Image.gameObject.SetActive(false);
    }
Пример #3
0
    public void ShowRedAim()
    {
        ImageSeconds Temp = new ImageSeconds();

        Temp.Image   = m_RedAim;
        Temp.Seconds = 0.1f;
        StopCoroutine("CoShowImageforSeconds_OpacityChange");
        StartCoroutine("CoShowImageforSeconds_OpacityChange", Temp);
    }
Пример #4
0
 //It is used to call Coroutine in other script
 public void ShowImageForSeconds(ImageSeconds _imageSeconds)
 {
     StartCoroutine("CoShowImageforSeconds", _imageSeconds);
 }
Пример #5
0
 //It is used to call Coroutine in other script
 public void ShowImageForSeconds_OpacityChange(ImageSeconds _imageSeconds)
 {
     StartCoroutine("ShowImageForSeconds_OpacityChange", _imageSeconds);
 }