public void Init() { DisplayUI(false); m_PoolObjectID = 0; #region Initaizle the floating damage number. if (FloatingNumberPerfab) { // Create a lot of object for pooling. ObjectPoolManager.Instance.CreaterPool(FloatingNumberPerfab, m_FloatingNumberRoot, 50); m_PoolObjectID = FloatingNumberPerfab.GetInstanceID(); } else { Debug.Log("Prefab not exist, please check agian."); } #endregion m_AmmoCountCanvasGroup.alpha = 1; m_AmmoStateCanvasGroup.alpha = 0; m_DamageIndicatorManager = GetComponentInChildren <DamageIndicatorManager>(); if (!m_DamageIndicatorManager) { Debug.Log("Can't find damage indicator manager."); } RespawnCountDownUI = GetComponentInChildren <RespawnCountDown>(); if (!RespawnCountDownUI) { Debug.Log("Can't find respawn count down script."); } KillConfirmUI = GetComponentInChildren <KillComfirmation>(); if (!KillConfirmUI) { Debug.Log("Can't find kill comfirmation script."); } //RoundInfoUI = GetComponentInChildren<RoundInfo>(); //if (!RoundInfoUI) Debug.Log("Can't find kill RoundInfo script."); CorssHair = GetComponentInChildren <CorssHairManager>(); if (!CorssHair) { Debug.Log("Can't find CorssHairManager script."); } CorssHair.Init(); }
/// <summary> /// When create a new indicator of update a indicator, use this method. /// </summary> /// <param name="info">All the information that the indicator should know about.</param> /// <param name="manager">The indicator's manager.</param> /// <param name="update">If the indicator just been created, no need to update.</param> public void UpdateIndicator(DamageIndicatorInfo info, DamageIndicatorManager manager) { // Apply settings. m_Info = info; m_Manager = manager; // Apply the attacker. m_AttackerID = info.AttackerID; m_IndicatorDisplayDuration = m_Info.IndicatorDisplayDuration; m_GroupUI.alpha = 1; // Stop fading out. StopAllCoroutines(); // Restart the indicator fade out process. StartCoroutine(Fadeout()); }
/// <summary> /// When a "new" indicator has been called /// </summary> public override void OnObjectReuse(params object[] options) { // Apply settings. m_Info = (DamageIndicatorInfo)options[0]; m_Manager = (DamageIndicatorManager)options[1]; // Reset the attacker ID. m_AttackerID = m_Info.AttackerID; m_IndicatorDisplayDuration = m_Info.IndicatorDisplayDuration; // Reset transparency. m_GroupUI.alpha = 1; // Start the indicator. StartCoroutine(Fadeout()); }