コード例 #1
0
    private void PlaceItemRandom(ItemTypes itemType, int numObjects)
    {
        var itemIndex = itemType.GetHashCode();

        for (var i = 0; i < numObjects; i++)
        {
            var listPosition     = Random.Range(0, itemSpaces.Count);
            var spatialPosition  = itemSpaces[listPosition];
            var absolutePosition = NumberToPosition(spatialPosition, innerSize);
            innerItemGrid[absolutePosition[0], absolutePosition[1]] = itemIndex;
            itemSpaces.RemoveAll(value => value == spatialPosition);
        }
    }
コード例 #2
0
 public void SetItemPosition(int x, int z, ItemTypes itemType)
 {
     itemGrid[x, z] = itemType.GetHashCode();
 }