コード例 #1
0
ファイル: Chunk.cs プロジェクト: friendly-games/td-redux
 /// <summary>
 ///  Indexer to get the GridItem at the specified coordinates.
 /// </summary>
 /// <param name="coordinate"> The position at which the item should be set or gotten.. </param>
 /// <returns> The GridItem at the specified position. </returns>
 public GridItem this[InnerChunkGridCoordinate coordinate]
 {
     get { return(_items[CalculateIndex(coordinate.X, coordinate.Y)]); }
     set
     {
         var existing = this[coordinate];
         OnGridItemChanged(this, new GridCoordinate(Position, coordinate), existing, value);
         _items[CalculateIndex(coordinate.X, coordinate.Y)] = value;
     }
 }
コード例 #2
0
 public GridCoordinate(ChunkCoordinate chunkCoordinate, InnerChunkGridCoordinate innerCoordinate)
 {
     X = (chunkCoordinate.X << Chunk.XGridCoordinateToChunkCoordinateBitShift) + innerCoordinate.X;
     Y = (chunkCoordinate.Y << Chunk.YGridCoordinateToChunkCoordinateBitShift) + innerCoordinate.Y;
 }