void OnPowerUpExpired(PowerUpExpiredEvent pwrUpExpiredEvent) { if (pwrUpExpiredEvent.powerUp.GetType() == typeof(PegSmasher)) { Debug.Log("Deactivating PuckPegCollisionEvents."); shouldEmitCollisionEvents = false; } }
protected void EmitExpiredEventAndSelfDestruct(IPowerUp powerUp, float delay) { PowerUpExpiredEvent powerUpExpiredEvent = new PowerUpExpiredEvent() { powerUp = powerUp }; EventManager.Instance.NotifyListeners(powerUpExpiredEvent); StartCoroutine(SelfDestructAfterDelay(delay)); }
void Awake() { Id = Guid.NewGuid(); pwrUpAcquiredEvent = EventManager.Instance.GetOrAddEventWithPayload(new PowerUpAcquiredEvent()); pwrUpExpiredEvent = EventManager.Instance.GetOrAddEventWithPayload(new PowerUpExpiredEvent()); if (puckVelModifier == 0f) { puckVelModifier = DEFAULT_PUCK_VEL_MOD; } if (maxPegBreaks == 0) { maxPegBreaks = DEFAULT_MAX_PEG_BREAKS; } }
void Awake() { Id = Guid.NewGuid(); pwrUpAcquiredEvent = EventManager.Instance.GetOrAddEventWithPayload(new PowerUpAcquiredEvent()); pwrUpExpiredEvent = EventManager.Instance.GetOrAddEventWithPayload(new PowerUpExpiredEvent()); if (puckBounceMod == 0f) { puckBounceMod = DEFAULT_PUCK_BOUNCE_MOD; } if (pwrUpDuration == 0f) { pwrUpDuration = DEFAULT_PWR_UP_DURATION; } }
public void OnPowerUpExpiration(PowerUpExpiredEvent powerUpExpiredEvent) { activePowerUps.Remove(powerUpExpiredEvent.powerUp); expiredPowerUps.Add(powerUpExpiredEvent.powerUp); }