Example #1
0
        public NavNodeMinor NavNodeMinorForMajor(NavNodeMajor toMajor)
        {
            int index = m_majorNodeMinorNodeConnectionPointsKeys.IndexOf(toMajor);

            if (index == -1)
            {
                return(null);
            }

            return(m_majorNodeMinorNodeConnectionPointsValues[index].list[0]);
        }
Example #2
0
        public void FindNavNodeMajorParent()
        {
            Transform parent = transform.parent;

            while (parent != null)
            {
                navNodeMajor = parent.GetComponent <NavNodeMajor>();
                if (navNodeMajor != null)
                {
                    break;
                }

                parent = parent.parent;
            }
        }
Example #3
0
        public void FormMajorToMajorConnection(NavNodeMinor fromMinor, NavNodeMajor toMajor)
        {
            int index = m_majorNodeMinorNodeConnectionPointsKeys.IndexOf(toMajor);

            if (index == -1)
            {
                m_majorNodeMinorNodeConnectionPointsKeys.Add(toMajor);
                m_majorNodeMinorNodeConnectionPointsValues.Add(new ListOfNavNodeMinors());
                index = m_majorNodeMinorNodeConnectionPointsValues.Count - 1;
            }

            m_majorNodeMinorNodeConnectionPointsValues[index].list.Add(fromMinor);

            if (m_majorNodeMinorNodeConnectionPointsValues[index].list.Count == 1)
            {
                data._ConnectTo(toMajor, NavNodeConnection.NavConnectionType.Standard);
            }
        }
Example #4
0
        public void RemoveMajorToMajorConnection(NavNodeMinor fromMinor, NavNodeMajor toMajor)
        {
            int index = m_majorNodeMinorNodeConnectionPointsKeys.IndexOf(toMajor);

            if (index == -1)
            {
                Debug.LogError("Can't disconnect from a Major that you have not connected to.");
                return;
            }

            m_majorNodeMinorNodeConnectionPointsValues[index].list.Remove(fromMinor);


            if (m_majorNodeMinorNodeConnectionPointsValues[index].list.Count == 0)
            {
                m_majorNodeMinorNodeConnectionPointsKeys.RemoveAt(index);
                m_majorNodeMinorNodeConnectionPointsValues.RemoveAt(index);
                data._DisconnectFrom(toMajor);
            }
        }