예제 #1
0
        virtual public void Initialize()
        {
            if (m_hasEvents)
            {
                OnStart.Dispatch();
            }

            if (!m_initialized)
            {
                m_engine       = AFEngine.Instance;
                m_stateManger  = AFEngine.Instance.GetStateManger();
                m_soundManager = AFSoundManager.Instance;
                m_assetManager = AFAssetManager.Instance;
                m_input        = AFInput.Instance;
                m_objects      = new List <AFObject>();

                if (m_hasEvents)
                {
                    OnInitialized.Dispatch();
                }
                BuildState();
                m_initialized = true;
            }
            else
            {
                Resume();
            }
        }
예제 #2
0
        virtual public void Destroy()
        {
            if (m_destroyable)
            {
                m_stateManger  = null;
                m_soundManager = null;
                m_input        = null;
                m_engine       = null;
                m_assetManager = null;

                for (int i = 0; i < m_objects.Count; ++i)
                {
                    Destroy(m_objects[i].gameObject);
                }

                m_objects.Clear();
                m_objects = null;
            }
            else
            {
                Debug.LogWarning("State could not be destroyed, set the destroyable value to true for complete the action");
            }

            if (m_hasEvents)
            {
                OnDestroy.Dispatch();
            }
        }
예제 #3
0
        override public void AFDestroy()
        {
            m_stateManger  = null;
            m_soundManager = null;
            m_assetManager = null;
            m_input        = null;
            m_engine       = null;

            for (int i = 0; i < m_objects.Count; ++i)
            {
                m_objects[i].AFDestroy();
            }

            for (int i = 0; i < m_gameObjects.Count; ++i)
            {
                if (AFObject.IsNull(m_gameObjects[i]))
                {
                    Destroy(m_gameObjects[i]);
                }
            }

            m_objects.Clear();
            m_objects = null;

            OnStart.RemoveAll();
            OnStart = null;

            OnDestroy.RemoveAll();
            OnDestroy = null;

            OnInitialized.RemoveAll();
            OnInitialized = null;

            OnPause.RemoveAll();
            OnPause = null;

            OnObjectAdded.RemoveAll();
            OnObjectAdded = null;

            OnObjectRemoved.RemoveAll();
            OnObjectRemoved = null;

            base.AFDestroy();
        }
 public void Initialize(AStateManager stateManager)
 {
 }
예제 #5
0
 public void Initialize(AStateManager stateManager)
 {
     m_stateManager = stateManager;
     AddTrasitionView(this.gameObject);
 }