示例#1
0
    public void UnSubscribe(PossibleStats possibleStats, StatEventHandlerInt observerToRemove)
    {
        switch (possibleStats)
        {
        case PossibleStats.Health:
            if (IsObserverInList(m_eventsHealth, observerToRemove))
            {
                m_eventsHealth -= observerToRemove;
                m_eventsHealth.Invoke(m_health);
            }
            break;

        case PossibleStats.CurrentHealth:
            if (IsObserverInList(m_eventsCurrentHealth, observerToRemove))
            {
                m_eventsCurrentHealth -= observerToRemove;
            }
            break;

        case PossibleStats.CurrentShield:
            if (IsObserverInList(m_eventsCurrentShield, observerToRemove))
            {
                m_eventsCurrentShield -= observerToRemove;
            }
            break;

        case PossibleStats.PA:
            if (IsObserverInList(m_eventsActionPoints, observerToRemove))
            {
                m_eventsActionPoints -= observerToRemove;
            }
            break;

        case PossibleStats.CurrentPA:
            if (IsObserverInList(m_eventsCurrentActionPoints, observerToRemove))
            {
                m_eventsCurrentActionPoints -= observerToRemove;
            }
            break;

        case PossibleStats.PM:
            if (IsObserverInList(m_eventsMovementPoints, observerToRemove))
            {
                m_eventsMovementPoints -= observerToRemove;
            }
            break;

        case PossibleStats.CurrentPM:
            if (IsObserverInList(m_eventsCurrentMovementPoints, observerToRemove))
            {
                m_eventsCurrentMovementPoints -= observerToRemove;
            }
            break;
        }
    }
示例#2
0
    public void Subscribe(PossibleStats possibleStats, StatEventHandlerInt newObserver)
    {
        switch (possibleStats)
        {
        case PossibleStats.Health:
            if (!IsObserverInList(m_eventsHealth, newObserver))
            {
                m_eventsHealth += newObserver;
                m_eventsHealth.Invoke(m_health);
            }
            break;

        case PossibleStats.CurrentHealth:
            if (!IsObserverInList(m_eventsCurrentHealth, newObserver))
            {
                m_eventsCurrentHealth += newObserver;
                m_eventsCurrentHealth.Invoke(m_currentHealth);
            }
            break;

        case PossibleStats.CurrentShield:
            if (!IsObserverInList(m_eventsCurrentShield, newObserver))
            {
                m_eventsCurrentShield += newObserver;
                m_eventsCurrentShield.Invoke(m_currentShield);
            }
            break;

        case PossibleStats.PA:
            if (!IsObserverInList(m_eventsActionPoints, newObserver))
            {
                m_eventsActionPoints += newObserver;
                m_eventsActionPoints.Invoke(m_actionPoint);
            }
            break;

        case PossibleStats.CurrentPA:
            if (!IsObserverInList(m_eventsCurrentActionPoints, newObserver))
            {
                m_eventsCurrentActionPoints += newObserver;
                m_eventsCurrentActionPoints.Invoke(m_currentActionPoint);
            }
            break;

        case PossibleStats.PM:
            if (!IsObserverInList(m_eventsMovementPoints, newObserver))
            {
                m_eventsMovementPoints += newObserver;
                m_eventsMovementPoints.Invoke(m_movementPoint);
            }
            break;

        case PossibleStats.CurrentPM:
            if (!IsObserverInList(m_eventsCurrentMovementPoints, newObserver))
            {
                m_eventsCurrentMovementPoints += newObserver;
                m_eventsCurrentMovementPoints.Invoke(m_currentMovementPoint);
            }
            break;
        }
    }