IEnumerator RemoveShotPatternPowerUp(ShotPatternPowerUpWrapper p_shotPatternPowerUp, float p_duration) { yield return(new WaitForSeconds(p_duration)); if (Time.time * 1000 < p_shotPatternPowerUp.time + p_shotPatternPowerUp.shotPatternPowerUp.m_duration * 1000) { StartCoroutine(RemoveShotPatternPowerUp(p_shotPatternPowerUp, (p_shotPatternPowerUp.time + p_shotPatternPowerUp.shotPatternPowerUp.m_duration * 1000 - Time.time * 1000) / 1000)); } else { m_spPowerUps.Remove(p_shotPatternPowerUp); p_shotPatternPowerUp.shotPatternPowerUp.End(this); } }
public void AddShotPatternPowerUp(ShotPatternPowerUp p_shotPatternPowerUp) { if (m_spPowerUps.Any(s => s.shotPatternPowerUp == p_shotPatternPowerUp)) { ShotPatternPowerUpWrapper wrapper = m_spPowerUps.Last(s => s.shotPatternPowerUp == p_shotPatternPowerUp); wrapper.time = Time.time * 1000; m_spPowerUps.Remove(wrapper); m_spPowerUps.AddLast(wrapper); } else { ShotPatternPowerUpWrapper wrapper = new ShotPatternPowerUpWrapper(p_shotPatternPowerUp); m_spPowerUps.AddLast(wrapper); StartCoroutine(RemoveShotPatternPowerUp(wrapper, p_shotPatternPowerUp.m_duration)); } }