Esempio n. 1
0
        public void DisposeScript()
        {
            if (m_instance == null)
            {
                return;
            }

            m_instance.Dispose();
            m_instance = null;
        }
Esempio n. 2
0
        public void ActivateScript(bool restored = false)
        {
            if (m_scriptType == null || m_instance != null)
            {
                return;
            }

            m_instance = Activator.CreateInstance(m_scriptType) as IMyStateMachineScript;
            Debug.Assert(m_instance != null, "Script instance should never be null.");
            if (restored)
            {
                m_instance.Deserialize();
            }

            m_instance.Init();

            // reset transitions to blocking state
            foreach (var storage in m_transitionNamesToVariableStorages.Values)
            {
                storage.SetValue(MyStringId.GetOrCompute("Left"), false);
            }
        }