Exemplo n.º 1
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (!collision.gameObject.GetComponent <CharController>())
            {
                return;
            }

            if (m_state < EndLevelState.Ready)
            {
                m_state = EndLevelState.Ready;
            }

            m_charactersReady.Add(collision.gameObject);
        }
Exemplo n.º 2
0
        private void OnTriggerExit2D(Collider2D collision)
        {
            if (!collision.gameObject.GetComponent <CharController>())
            {
                return;
            }

            GameObject toDelete = m_charactersReady.FirstOrDefault(c => GameObject.ReferenceEquals(c, collision.gameObject));

            if (toDelete)
            {
                m_charactersReady.Remove(toDelete);
            }

            if (m_state < EndLevelState.Ready && m_charactersReady.Count == 0)
            {
                m_state = EndLevelState.NotReady;
            }
        }