public bool Get(IntVector3 candidate, out T item) { if (candidate.Equal(center) || CubeNeighbors6.IsNeighbor(center, candidate)) { if (storage.ContainsKey(candidate)) { item = storage[candidate]; return(true); } } item = default(T); return(false); }
public bool Set(IntVector3 candidate, T item) { if (CubeNeighbors6.IsNeighbor(center, candidate) || candidate.Equal(center)) { if (storage.ContainsKey(candidate)) { storage[candidate] = item; } else { storage.Add(candidate, item); } return(true); } item = default(T); return(false); }
public T this[IntVector3 key] { get { if (storage.ContainsKey(key)) { return(storage[key]); } return(default(T)); } set { if (storage.ContainsKey(key)) { storage[key] = value; } else if (center.Equal(key) || CubeNeighbors6.IsNeighbor(center, key)) { storage.Add(key, value); } } }