root/src/BRAINSFramework/Map/Cluster.cs
| 13 | 20 | ||
|---|---|---|---|
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Text; | 4 | using System.Text; |
5 | using Brains.Framework; | 5 | using Brains.Framework; |
6 | using Microsoft.Xna.Framework; | ||
6 | 7 | ||
7 | namespace Brains.Framework.Map | 8 | namespace Brains.Framework.Map |
8 | { | 9 | { |
... | ... | ||
41 | //HACK: should support different sized grids | 42 | //HACK: should support different sized grids |
42 | get { return Grids[0].Rows* Rows; } | 43 | get { return Grids[0].Rows* Rows; } |
43 | } | 44 | } |
45 | |||
46 | public Grid GetGridAtPosition(Vector2 position) | ||
47 | { | ||
48 | foreach (var item in Grids) | ||
49 | { | ||
50 | if ( | ||
51 | (position.X > item.Position.X && position.X < (item.Position.X + item.Width)) && | ||
52 | (position.Y > item.Position.Y && position.Y < (item.Position.Y + item.Height)) | ||
53 | ) | ||
54 | { | ||
55 | return item; | ||
56 | } | ||
57 | } | ||
58 | return null; | ||
59 | } | ||
60 | |||
44 | } | 61 | } |
45 | } | 62 | } |
Download diff