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)); } }
public IEnumerator CoShowImageforSeconds(ImageSeconds _imageSeconds) { _imageSeconds.Image.gameObject.SetActive(true); yield return(new WaitForSeconds(_imageSeconds.Seconds)); _imageSeconds.Image.gameObject.SetActive(false); }
public void ShowRedAim() { ImageSeconds Temp = new ImageSeconds(); Temp.Image = m_RedAim; Temp.Seconds = 0.1f; StopCoroutine("CoShowImageforSeconds_OpacityChange"); StartCoroutine("CoShowImageforSeconds_OpacityChange", Temp); }
//It is used to call Coroutine in other script public void ShowImageForSeconds(ImageSeconds _imageSeconds) { StartCoroutine("CoShowImageforSeconds", _imageSeconds); }
//It is used to call Coroutine in other script public void ShowImageForSeconds_OpacityChange(ImageSeconds _imageSeconds) { StartCoroutine("ShowImageForSeconds_OpacityChange", _imageSeconds); }