当前位置: 首页>>代码示例>>C#>>正文


C# IRandom.RandomRange方法代码示例

本文整理汇总了C#中IRandom.RandomRange方法的典型用法代码示例。如果您正苦于以下问题:C# IRandom.RandomRange方法的具体用法?C# IRandom.RandomRange怎么用?C# IRandom.RandomRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRandom的用法示例。


在下文中一共展示了IRandom.RandomRange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDecorationAt

    private void CreateDecorationAt(int blockX, int blockY, int blockZ, IRandom random)
    {
        int trunkLength = random.RandomRange(6, 10);
        // Trunk
        CreateColumnAt(blockX, blockY, blockZ, trunkLength, BlockType.Dirt);

        // Leaves
        CreateSphereAt(blockX, blockY, blockZ + trunkLength, random.RandomRange(3, 4));
    }
开发者ID:thiasman,项目名称:MineLike,代码行数:9,代码来源:StandardTreeDecorator.cs

示例2: CreateDecorationAt

 private void CreateDecorationAt(int blockX, int blockY, int blockZ, IRandom random)
 {
     //PALM TREES
     int trunkLength = random.RandomRange(6, 10);
     // Trunk
     for (int z = blockZ + 1; z <= blockZ + trunkLength; z++)
     {
         CreateTrunkAt(blockX, blockY, z);
     }
     CreateCrossAt(blockX, blockY, blockZ + trunkLength, random.RandomRange(2, 3));
     ///PALM TREES
     //
 }
开发者ID:skistua,项目名称:MinePackage,代码行数:13,代码来源:PalmTreeDecorator.cs

示例3: IsAValidLocationforDecoration

    private bool IsAValidLocationforDecoration(int blockX, int blockY, int blockZ, IRandom random)
    {
        if (random.RandomRange(1, 1000) < 999)
        {
            return false;
        }

        return IsLocationLowEnough(blockZ) && TheSpaceHereIsEmpty(blockX, blockY, blockZ);
    }
开发者ID:skistua,项目名称:MinePackage,代码行数:9,代码来源:WeavingRockPillarDecoration.cs

示例4: IsAValidLocationforDecoration

    private bool IsAValidLocationforDecoration(int blockX, int blockY, int blockZ, IRandom random)
    {
        if (random.RandomRange(0, 10000) < 9995)
        {
            return false;
        }

        if (!TheSpaceHereIsEmpty(blockX, blockY, blockZ - 1))
        {
            return false;
        }

        return true;
    }
开发者ID:skistua,项目名称:MinePackage,代码行数:14,代码来源:TikiStatueDecoration.cs

示例5: IsAValidLocationforDecoration

    /// <summary>
    /// Determines if a tree decoration even wants to be at this location.
    /// </summary>
    /// <param name="blockX"></param>
    /// <param name="blockY"></param>
    /// <param name="blockZ"></param>
    /// <param name="random"></param>
    /// <returns></returns>
    private bool IsAValidLocationforDecoration(int blockX, int blockY, int blockZ, IRandom random)
    {
        // We don't want TOO many trees...make it a 1% chance to be drawn there.
        if (random.RandomRange(1, 1000) < 999)
        {
            return false;
        }

        if (!IsLocationLowEnough(blockZ))
        {
            return false;
        }

        // Trees like to have a minimum amount of space to grow in.
        return TheSpaceHereIsEmpty(blockX, blockY, blockZ);
    }
开发者ID:thiasman,项目名称:MineLike,代码行数:24,代码来源:StandardTreeDecorator.cs

示例6: CreateDecorationAt

 private void CreateDecorationAt(int blockX, int blockY, int blockZ, IRandom random)
 {
     //PINE TREES
     int trunkLength = random.RandomRange(10, 20);
     // Trunk
     for (int z = blockZ + 1; z <= blockZ + trunkLength; z++)
     {
         CreateTrunkAt(blockX, blockY, z);
     }
     //leaves
     for (int z = blockZ + 3; z <= blockZ + trunkLength; z += 2)
     {
         CreateDiskAt(blockX, blockY, z, (blockZ + trunkLength - z) / 3);
     }
     CreateLeavesAt(blockX, blockY, blockZ + trunkLength);
 }
开发者ID:skistua,项目名称:MinePackage,代码行数:16,代码来源:PineTreeDecorator.cs

示例7: IsAValidLocationforDecoration

    /// <summary>
    /// Determines if a tree decoration even wants to be at this location.
    /// </summary>
    /// <param name="blockX"></param>
    /// <param name="blockY"></param>
    /// <param name="blockZ"></param>
    /// <param name="random"></param>
    /// <returns></returns>
    private bool IsAValidLocationforDecoration(int blockX, int blockY, int blockZ, IRandom random)
    {
        // We don't want TOO many trees...make it a 1% chance to be drawn there.
        if (random.RandomRange(1, 1000) < 999)
        {
            return false;
        }

        // Trees don't like to grow too high
        if (blockZ >= m_WorldData.DepthInBlocks - 20)
        {
            return false;
        }

        // Trees like to have a minimum amount of space to grow in.
        return SpaceAboveIsEmpty(blockX, blockY, blockZ, 8, 2, 2);
    }
开发者ID:skistua,项目名称:MinePackage,代码行数:25,代码来源:PalmTreeDecorator.cs


注:本文中的IRandom.RandomRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。