//public static T LogSignalREvent<T>(this IEventPayload eventPayload) where T : IEventPayload {
        //    if (IsVerbose) Logger?.LogDebug($"{Environment} : {eventPayload.GetType().Name}");
        //    return (T)eventPayload;
        //}


        //        public virtual void ComponentStateChangeFiring<T>(ComponentStateChange<T> componentStateChange) where T : ComponentState {
        //    _eventAggregator.GetEvent<ComponentStateChangeEvent<ComponentStateChange<T>>>().Publish(componentStateChange);
        //}

        public static T LogLocalEvent <T>(this IEventPayload eventPayload) where T : IEventPayload
        {
            if (IsVerbose)
            {
                Logger?.LogDebug($"{Environment} : {eventPayload.GetType().Name}");
            }
            return((T)eventPayload);
        }
Пример #2
0
 public void OnPowerUpExpired(IEventPayload genericPayload)
 {
     if (genericPayload.GetType() == typeof(PowerUpExpiredPayload))
     {
         PowerUpExpiredPayload pwrUpExpiredPayload = (PowerUpExpiredPayload)genericPayload;
         activePowerUps.Remove(pwrUpExpiredPayload.PowerUp);
     }
 }
Пример #3
0
 public void OnScore(IEventPayload genericPayload)
 {
     if (genericPayload.GetType() == typeof(ScorePayload))
     {
         ScorePayload scorePayload = (ScorePayload)genericPayload;
         totalScore += scorePayload.Score;
         UpdateScoreDisplay();
     }
 }
Пример #4
0
 public void OnPuckReset(IEventPayload genericPayload)
 {
     if (genericPayload.GetType() == typeof(PuckResetPayload))
     {
         launchState        = LaunchState.LAUNCH_READY;
         puckBody.bodyType  = RigidbodyType2D.Kinematic;
         LaunchAimStart     = Vector2.zero;
         LaunchAimEnd       = Vector2.zero;
         transform.position = new Vector2(startLaunchXPos, launchYPos);
     }
 }
Пример #5
0
    /* ~~~~~~~~~~~~~~~~~~~~ Unity Event Handlers ~~~~~~~~~~~~~~~~~~~~ */

    public void OnPowerUpAcquired(IEventPayload genericPayload)
    {
        if (genericPayload.GetType() == typeof(PowerUpAcquiredPayload))
        {
            PowerUpAcquiredPayload pwrUpAcquiredPayload = (PowerUpAcquiredPayload)genericPayload;
            if (pwrUpAcquiredPayload.Type == ActivationType.IMMEDIATE)
            {
                ActivatePowerUp(pwrUpAcquiredPayload.PowerUp);
            }
            else
            {
                storedPowerUps.Enqueue(pwrUpAcquiredPayload.PowerUp);
            }
        }
    }
Пример #6
0
 public static string ToJson(this IEventPayload eventPayload)
 {
     return(JsonConvert.SerializeObject(eventPayload));
 }