/// <summary>
            ///
            /// </summary>
            void Start()
            {
                m_instance = this; // initialise singleton

                Blackboard[] blackboards = Resources.FindObjectsOfTypeAll <Blackboard>();

                m_blackboards = new List <Blackboard>();
                for (int i = 0; i < blackboards.Length; i++)
                {
                    Blackboard blackboard = ScriptableObject.CreateInstance <Blackboard>();
                    blackboard.Copy(blackboards[i]);
                    m_blackboards.Add(blackboard);
                }

                // retrieve manager from each component
                if (m_audioComponent != null)
                {
                    m_audioManager = m_audioComponent.GetAudioManager();
                }
                if (m_backgroundComponent != null)
                {
                    m_backgroundManager = m_backgroundComponent.GetBackgroundManager();
                }
                if (m_branchComponent != null)
                {
                    m_branchManager = m_branchComponent.GetBranchManager();
                }
                if (m_characterComponent != null)
                {
                    m_characterManager = m_characterComponent.GetCharacterManager();
                }
                if (m_dialogueComponent != null)
                {
                    m_dialogueManager = m_dialogueComponent.GetDialogueManager();
                }
                if (m_logComponent != null)
                {
                    m_logManager = m_logComponent.GetLogManager();
                }
                if (m_saveComponent != null)
                {
                    m_saveManager = new SaveManager(this, m_saveComponent);
                }

                m_utilityManager  = new UtilityManager();
                m_variableManager = new VariableManager();

                m_nodeEvaluator = new NodeEvaluator(this);

                // delete this later
                NewScene(m_startScene);
            }
Пример #2
0
        private void Awake()
        {
            m_instance = this;

            Blackboard[] blackboards = Resources.FindObjectsOfTypeAll <Blackboard>();

            m_blackboards = new List <Blackboard>();
            for (int i = 0; i < blackboards.Length; i++)
            {
                Blackboard blackboard = ScriptableObject.CreateInstance <Blackboard>();
                blackboard.Copy(blackboards[i]);
                m_blackboards.Add(blackboard);
            }

            if (m_audioComponent != null)
            {
                m_audioManager = m_audioComponent.GetAudioManager();
            }
            if (m_backgroundComponent != null)
            {
                m_backgroundManager = m_backgroundComponent.GetBackgroundManager();
            }
            if (m_branchComponent != null)
            {
                m_branchManager = m_branchComponent.GetBranchManager();
            }
            if (m_characterComponent != null)
            {
                m_characterManager = m_characterComponent.GetCharacterManager();
            }
            if (m_dialogueComponent != null)
            {
                m_dialogueManager = m_dialogueComponent.GetDialogueManager();
            }
            if (m_saveComponent != null)
            {
                m_saveManager = new SaveManager(this, m_saveComponent);
            }

            m_utilityManager  = new UtilityManager();
            m_variableManager = new VariableManager();

            m_nodeEvaluator = new NodeEvaluator(this);
        }