Example #1
0
 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];
 }
Example #2
0
        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]);
        }
Example #3
0
        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();
            }
        }
Example #4
0
        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);
                }
            }
        }