예제 #1
0
        protected override void UnloadData()
        {
            Debug.Assert(m_ropeIdToRope.Count == 0, "All ropes should have been removed by now.");
            Debug.Assert(m_hookIdToHook.Count == 0, "All hooks should have been removed by now.");
            m_ropeIdToRope.Clear();
            m_hookIdToHook.Clear();
            m_hookIdToWinding.Clear();
            m_hookIdToRelease.Clear();
            m_hookIdToRopeId.Clear();
            m_ropesToRemove.Clear();
            foreach (var winding in m_hookIdToActiveWinding.Values)
            {
                if (winding.Emitter != null)
                    winding.Emitter.StopSound(true);
            }
            m_hookIdToActiveWinding.Clear();
            m_hookIdToActiveRelease.Clear();
            m_ropeIdToRayCastRelease.Clear();
            m_hookIdToRopeLimits.Clear();
            m_hookIdToUnlockedWinding.Clear();
            m_ropeIdToInit.Clear();

            if (m_ropeAttacher != null)
            {
                m_ropeAttacher.Clear();
                m_ropeAttacher = null;
            }

            Static = null;

            base.UnloadData();
        }
예제 #2
0
        public override void LoadData()
        {
            Static = this;

            if (MySession.Static.CreativeMode)
            {
                MyRopeDefinition defaultRope = null;
                foreach (var rope in MyDefinitionManager.Static.GetRopeDefinitions())
                {
                    if (rope.IsDefaultCreativeRope)
                    {
                        defaultRope = rope;
                        break;
                    }
                }

                if (defaultRope != null)
                    m_ropeAttacher = new MyRopeAttacher(defaultRope);
            }

            base.LoadData();
        }