Exemplo n.º 1
0
        /// <summary>
        /// Performs the first update on the mounter and takes the appropriate action if it completes or needs
        /// more updates.
        /// </summary>
        private void RunMounter(IAccessoryMounter mounter, GameObject owner, MountPoint location,
                                BodyCoverage additionalCoverage)
        {
            CleanupCurrentState();

            int id = m_MounterId + 1;

            m_MounterId = id;

            m_CurrentCoverage = mounter.GetCoverageFor(location.LocationType) | additionalCoverage;

            if (mounter.UpdateMount(this, location, !Application.isPlaying))
            {
                StartCoroutine(DoDurationMount(mounter, owner, location));
            }
            else
            {
                SetState(AccessoryStatus.Mounted, owner, location);
            }
        }
Exemplo n.º 2
0
        // TODO: EVAL: Convert mounting to a method that supports serialization.
        // This is not a high proiority, especially since the standard mounters support
        // immediate completion outside of play mode.  But having all major features except
        // mounting provide support for serialization might be an issue.

        /// <summary>
        /// Kicks off a coroutine to run the mounter through to completion.
        /// </summary>
        private System.Collections.IEnumerator DoDurationMount(
            IAccessoryMounter mounter, GameObject owner, MountPoint location)
        {
            m_CurrentMounter = mounter;
            var id = m_MounterId;

            SetState(AccessoryStatus.Mounting, owner, location);

            yield return(null);

            while (m_MounterId == id && !LizittUtil.IsUnityDestroyed(mounter) && mounter.UpdateMount(this, location))
            {
                yield return(null);
            }

            if (m_MounterId == id)
            {
                SetState(AccessoryStatus.Mounted, owner, location);
                m_CurrentMounter = null;
            }
        }