private void CheckPowerUp(ref PowerUpHolder _slot) { if (_slot.activated) { _slot.powerUpTimer -= Time.deltaTime; if (_slot.powerUpTimer <= 0) { _slot.activated = false; _slot.powerUp.ResetEffects(); _slot.powerUp = null; } if (m_isPlayer) { m_UIManager.UpdatePowerUpUI(slot1, slot2); } } }
private void ActivatePowerUp(ref PowerUpHolder _slot) { if (_slot.canActivate) { if (_slot.powerUp != null) { switch (_slot.powerUp.powerUp) { case EPowerUps.SUPER_SPEED: if (GameController.instance.superSpeedSounds.Length > 0) { PausedMenuManager._instance?.PlaySFX(GameController.instance.superSpeedSounds[Random.Range(0, GameController.instance.superSpeedSounds.Length)]); if (GameController.instance.superSpeedParticle) { Instantiate(GameController.instance.superSpeedParticle, transform.position, Quaternion.identity); } } break; case EPowerUps.BACK_OFF: if (GameController.instance.backOffSounds.Length > 0) { PausedMenuManager._instance?.PlaySFX(GameController.instance.backOffSounds[Random.Range(0, GameController.instance.backOffSounds.Length)]); if (GameController.instance.backOffParticle) { Instantiate(GameController.instance.backOffParticle, transform.position + new Vector3(0f, 5f, 0f), Quaternion.identity); } if (GameController.instance.backOffDecal) { Instantiate(GameController.instance.backOffDecal, new Vector3(m_playerTaggingIdentifier.hammerBopAim.transform.position.x, 0.2f, m_playerTaggingIdentifier.hammerBopAim.transform.position.z), GameController.instance.backOffDecal.transform.rotation); } } break; case EPowerUps.SUPER_SLAM: if (GameController.instance.superSlamSounds.Length > 0) { PausedMenuManager._instance?.PlaySFX(GameController.instance.superSlamSounds[Random.Range(0, GameController.instance.superSlamSounds.Length)]); if (GameController.instance.superSlamParticle) { Instantiate(GameController.instance.superSlamParticle, transform.position, Quaternion.identity); } if (GameController.instance.superSlamDecal) { Instantiate(GameController.instance.superSlamDecal, new Vector3(m_playerTaggingIdentifier.hammerBopAim.transform.position.x, 0.05f, m_playerTaggingIdentifier.hammerBopAim.transform.position.z), GameController.instance.superSlamDecal.transform.rotation); } } break; } _slot.canActivate = false; _slot.powerUp.ActivatePowerUp(); if (_slot.powerUp.hasDuration) { _slot.powerUpTimer = _slot.powerUp.duration; _slot.activated = true; } else { _slot.powerUp.ResetEffects(); _slot.powerUp = null; } if (m_isPlayer) { m_UIManager.UpdatePowerUpUI(slot1, slot2); } } } }