Esempio n. 1
0
 internal void OnCollide(int x, int y, int layer, Sprite asker)
 {
     if (asker.Noclip || x < 0 || y < 0 || x >= cols || y >= rows) return;
     if (layers[layer].ladderMove[x, y] == null) {
         if (asker is PlayerSprite) {
             layers[layer].objects[x, y].ForEach(o => {
                 if (!o.Noclip) o.OnCollide();
             });
         }
         else {
             Sprite s = layers[layer].objects[x, y].Find(o => o is PlayerSprite);
             if (s != null) asker.OnCollide();
         }
     }
     else {
         if (asker is PlayerSprite) {
             layers[layer].ladderMove[x, y].objects[x, y].ForEach(o => {
                 if (!o.Noclip) o.OnCollide();
             });
         }
         else {
             Sprite s = layers[layer].ladderMove[x, y].objects[x, y].Find(o => o is PlayerSprite);
             if (s != null) s.OnCollide();
         }
     }
 }