public void ClearAllEvents(PossibleStats possibleStats) { switch (possibleStats) { case PossibleStats.Health: m_eventsHealth = null; break; case PossibleStats.CurrentHealth: m_eventsCurrentHealth = null; break; case PossibleStats.CurrentShield: m_eventsCurrentShield = null; break; case PossibleStats.PA: m_eventsActionPoints = null; break; case PossibleStats.CurrentPA: m_eventsCurrentActionPoints = null; break; case PossibleStats.PM: m_eventsMovementPoints = null; break; case PossibleStats.CurrentPM: m_eventsCurrentMovementPoints = null; break; } }
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; } }
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; } }