Esempio n. 1
0
    public void SubscribeToEvent(EventType eventType, IEnemyListener listener)
    {
        switch (eventType)
        {
        case EventType.EnemyDied:
            if (listener.GetSingleEnemyDiedDelegate() != null)
            {
                SingleEnemyDied += listener.GetSingleEnemyDiedDelegate();
            }
            break;

        case EventType.EnemyHitted:
            if (listener.GetEnemyHittedDelegate() != null)
            {
                EnemyHitted += listener.GetEnemyHittedDelegate();
            }
            break;

        case EventType.EnemyAttacked:
            if (listener.GetEnemyAttackedDelegate() != null)
            {
                EnemyAttacked += listener.GetEnemyAttackedDelegate();
            }
            break;

        case EventType.EnemyStopAttacking:
            if (listener.GetEnemyStopAttackingDelegate() != null)
            {
                EnemyStopedAttacking += listener.GetEnemyStopAttackingDelegate();
            }
            break;
        }
    }
Esempio n. 2
0
    public void UnsubscribeFromEvent(EventType eventType, IEnemyListener listener)
    {
        switch (eventType)
        {
        case EventType.EnemyDied:
            SingleEnemyDied -= listener.GetSingleEnemyDiedDelegate();
            break;

        case EventType.EnemyHitted:
            EnemyHitted -= listener.GetEnemyHittedDelegate();
            break;

        case EventType.EnemyAttacked:
            EnemyAttacked -= listener.GetEnemyAttackedDelegate();
            break;

        case EventType.EnemyStopAttacking:
            EnemyStopedAttacking -= listener.GetEnemyStopAttackingDelegate();
            break;
        }
    }