예제 #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;
     }
 }
예제 #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;
        }
예제 #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);
        }
예제 #4
0
 /// <summary>
 /// Checks if the given Souvenir is the currently active Souvenir.
 /// </summary>
 public bool IsActiveSouvenir(Souvenir souvenir)
 {
     return(souvenir == currentSouvenir);
 }
예제 #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);
 }