public YPartition getPartitionAt(float y) { float index = y - (y % _partitionHeight); if (!dictionary.ContainsKey(index)) { YPartition newPartition = new YPartition(index, index + _partitionHeight); dictionary.Add(index, newPartition); } return dictionary[index]; }
public YPartition getPartitionAt(float y) { float index = y - (y % _partitionHeight); if (!dictionary.ContainsKey(index)) { YPartition newPartition = new YPartition(index, index + _partitionHeight); dictionary.Add(index, newPartition); } return(dictionary[index]); }
public void partitionObject(IGameObject iGameObject) { YPartition t = getPartitionAt(iGameObject.top); YPartition b = getPartitionAt(iGameObject.bottom); t.Add(iGameObject); t.Sort(); if (t != b) { b.Add(iGameObject); b.Sort(); } }
public void checkExternalCollisionsY(YTable list) { checkPartition(); list.checkPartition(); foreach (KeyValuePair <float, YPartition> entry in dictionary) { if (list.dictionary.ContainsKey(entry.Key)) { YPartition otherPartition = list.dictionary[entry.Key]; entry.Value.checkExternalCollisions(otherPartition); } } }