コード例 #1
0
 private void ResetCoreSettings()
 {
     m_MotionRoot        = null;
     m_PrimaryCollider   = null;
     m_Owner             = null;
     m_Status            = OutfitStatus.Unmanaged;
     m_UseDefaultStorage = true;
 }
コード例 #2
0
        /// <summary>
        /// Set the outfit status.
        /// </summary>
        /// <remarks>
        /// <para>
        /// <paramref name="owner"/> must be non-null for all states except 'unmanaged'.
        /// </para>
        /// <para>
        /// Activates and deactivates the component's GameObject as appropriate based on the value of
        /// <see cref="UseDefaultStorage"/>.
        /// </para>
        /// <para>
        /// If using default storage: The 'stored' event will be sent before GameObject deactivation.  The other
        /// events will be sent after activation.  (I.e. Events will always be sent while the GameObject is active.)
        /// </para>
        /// </remarks>
        /// <param name="status">The status.</param>
        /// <param name="owner">The owner.  (Required for all status except 'unmanaged'.)</param>
        /// <returns>
        /// True if the operation was successful.  False on error.
        /// </returns>
        public override bool SetState(OutfitStatus status, GameObject owner)
        {
            if (!(status == OutfitStatus.Unmanaged || owner))
            {
                Debug.LogError("Can't set status with a null owner: " + status, this);
                return(false);
            }

            if (m_Status == status && m_Owner == owner)
            {
                return(true);
            }

            if (status == OutfitStatus.Unmanaged && owner)
            {
                Debug.LogWarning("Can't set owner on an unmanaged outfit.  Owner ignored: " + owner, this);
                owner = null;
            }

            m_Owner  = owner;
            m_Status = status;

            if (m_Status == OutfitStatus.Stored)
            {
                // Event before deactivation.
                Observers.SendStateChange(this);

                if (m_UseDefaultStorage)
                {
                    gameObject.SetActive(false);
                }
            }
            else
            {
                // Event after activation.
                if (m_UseDefaultStorage)
                {
                    gameObject.SetActive(true);
                }

                Observers.SendStateChange(this);
            }

            return(true);
        }
コード例 #3
0
 /// <summary>
 /// Set the outfit status.
 /// </summary>
 /// <remarks>
 /// <para>
 /// <paramref name="owner"/> must be non-null for all states except 'unmanaged'.
 /// </para>
 /// </remarks>
 /// <param name="status">The status.</param>
 /// <param name="owner">The owner.  (Required for all status except 'unmanaged'.)</param>
 /// <returns>True if the operation was successful.  False on error.</returns>
 public abstract bool SetState(OutfitStatus status, GameObject owner);