Beispiel #1
0
 public void HighLightChunkByPoint(int _x, int _y)
 {
     int x = _x + (int)viewport.X;
     int y = _y + (int)viewport.Y;
     RenderChunk host = null;
     for (int i = 0; i < renderchunks.Count; ++i)
     {
         RenderChunk rc = renderchunks[i];
         if (!(rc is HoverStone))
             continue;
         Rectangle rect = new Rectangle((int)(rc.Position.X - rc.FrameSize.X * 0.3f),
                                         (int)(rc.Position.Y - rc.FrameSize.Y * 0.3f),
                                         (int)(rc.FrameSize.X * 0.6f),
                                         (int)(rc.FrameSize.Y * 0.6f));
         if (rect.Contains(new Point(x, y)))
         {
             host = rc;
             break;
         }
     }
     if (host != null)
     {
         if (_hostCharacter != null)
             _hostCharacter.Picture.HighLight = false;
         host.HighLight = true;
         _hostChunk = host;
     }
     else
     {
         if (_hostChunk != null)
         {
             _hostChunk.HighLight = false;
             _hostChunk = null;
         }
     }
 }
Beispiel #2
0
 public void AddRenderChunk(RenderChunk rc)
 {
     lock (lockThis)
     {
         renderchunks.Add(rc);
         rc.Scene = this;
         SortRenderChunksByLayer();
     }
 }