示例#1
0
文件: GridIndex.cs 项目: tjm35/Cobalt
 private void RemoveAt(GridTransform i_gt, Vector3Int i_addr)
 {
     Debug.Assert(m_index.ContainsKey(i_addr));
     Debug.Assert(m_index[i_addr] != null);
     m_index[i_addr].Remove(i_gt);
     m_reverseLookup.Remove(i_gt);
 }
示例#2
0
文件: GridIndex.cs 项目: tjm35/Cobalt
 public void UpdateIndex(GridTransform i_gt)
 {
     Deindex(i_gt);
     AddAt(i_gt, i_gt.GridPos);
     Debug.Assert(GetAt(i_gt.GridPos).Count() > 0, "GetAt returns empty list.");
     Debug.Assert(GetComponentAt <GridTransform>(i_gt.GridPos) != null, "GetComponentAt returns null.");
     Debug.Assert(GetComponentsAt <GridTransform>(i_gt.GridPos).Contains(i_gt), "GetComponentAt returns wrong address.");
 }
示例#3
0
文件: GridIndex.cs 项目: tjm35/Cobalt
        public void Deindex(GridTransform i_gt)
        {
            Vector3Int oldAddress;

            if (m_reverseLookup.TryGetValue(i_gt, out oldAddress))
            {
                RemoveAt(i_gt, oldAddress);
            }
        }
示例#4
0
文件: GridIndex.cs 项目: tjm35/Cobalt
 private void AddAt(GridTransform i_gt, Vector3Int i_addr)
 {
     if (!m_index.ContainsKey(i_addr))
     {
         m_index[i_addr] = new List <GridTransform>();
         Debug.Assert(m_index.TryGetValue(i_addr, out var list), "TryGetValue failed.");
     }
     Debug.Assert(m_index[i_addr].Contains(i_gt) == false);
     m_index[i_addr].Add(i_gt);
     Debug.Assert(m_index[i_addr].Contains(i_gt) == true);
     m_reverseLookup[i_gt] = i_addr;
 }