Ejemplo n.º 1
0
 /// <summary>
 /// Unsets the given Souvenir as the active Souvenir if it currently is.
 /// </summary>
 public void MakeInactive(Souvenir souvenir)
 {
     if (currentSouvenir == souvenir)
     {
         currentSouvenir = null;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the given Souvenir as the currently active Souvenir
        /// and puts the previously active Souvenir in a sleeping state.
        /// </summary>
        public void MakeActive(Souvenir souvenir)
        {
            if (currentSouvenir == souvenir)
            {
                return;
            }

            if (currentSouvenir != null)
            {
                currentSouvenir.Sleep();
            }
            currentSouvenir = souvenir;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Checks if the given Souvenir can be put in a passive
        /// state. If so, it becomes the active Souvenir and the
        /// previously active Souvenir is put in a sleeping state.
        /// </summary>
        public bool TryMakePassive(Souvenir souvenir)
        {
            if (CanMakePassive(souvenir))
            {
                if (currentSouvenir != null && currentSouvenir != souvenir)
                {
                    currentSouvenir.Sleep();
                }
                currentSouvenir = souvenir;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Checks if the given Souvenir is the currently active Souvenir.
 /// </summary>
 public bool IsActiveSouvenir(Souvenir souvenir)
 {
     return(souvenir == currentSouvenir);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Indicates whether the given Souvenir can be put in a passive state or not.
 /// </summary>
 private bool CanMakePassive(Souvenir souvenir)
 {
     return(currentSouvenir == null || !currentSouvenir.IsInActiveState);
 }