예제 #1
0
파일: Ship.cs 프로젝트: dannyd89/yafbcore
        /// <summary>
        /// Continues the ship if possible
        /// <para>Can trigger ActiveStateChanged event if IsActive is false</para>
        /// </summary>
        /// <returns>True if continue was successful</returns>
        public bool TryContinue()
        {
            try
            {
                reset();

                if (!ship.IsActive)
                {
                    ActiveStateChanged?.Invoke(this, EventArgs.Empty);
                    return(false);
                }

                if (!ship.IsAlive)
                {
                    ship.Continue();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);

                return(false);
            }
        }
예제 #2
0
        /// <summary>Sets the active state of this quest</summary>
        public void SetActive(bool value, bool fromFile = false)
        {
            if (value != isActive)
            {
                isActive = value;
                ActiveStateChanged?.Invoke(this, isActive);

                if (!fromFile)
                {
                    SaveActiveStateToFile();
                }
            }
        }
예제 #3
0
        /// <summary>Sets the active state of this quest</summary>
        private void SetActiveInternal(bool value, bool saveToFile)
        {
            if (value != isActive)
            {
                isActive = value;
                ActiveStateChanged?.Invoke(this, isActive);

                if (saveToFile)
                {
                    SaveActiveStateToFile();
                }
            }
        }