本文整理汇总了C#中Seed.Range方法的典型用法代码示例。如果您正苦于以下问题:C# Seed.Range方法的具体用法?C# Seed.Range怎么用?C# Seed.Range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seed
的用法示例。
在下文中一共展示了Seed.Range方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public void Generate(Seed sRand)
{
int xArray = roomMatrix.GetLength(0);
int yArray = roomMatrix.GetLength(1);
for (int i = 0; i < xArray; i++)
{
for (int m = 0; m < yArray; m++)
{
if(i==5 && m==0 && connectionsToRooms[3] ==1)
{
//add door bottom
roomMatrix[i,m] = 5;
}
else if(i==5 && m==10 && connectionsToRooms[1] ==1)
{
//add door top
roomMatrix[i,m] = 2;
}
else if(i==0 && m==5 && connectionsToRooms[0] ==1)
{
//add door left
roomMatrix[i,m] = 3;
}
else if(i==10 && m==5 && connectionsToRooms[2] ==1)
{
//add door right
roomMatrix[i,m] = 4;
}
else
{
//if a wall
if(i==0||i==10||m==10||m==0)
{
roomMatrix[i,m] = 6;
}
else // actually do room generation
{
if(roomPosition[0]==6&&roomPosition[1]==6){roomMatrix[i,m]=8;}
roomMatrix[i,m] = (int) sRand.Range(0,tileCount-1);
}
}
}
}
}
示例2: rockChance
public void rockChance(Seed sRand)
{
if(hasDoor){return;}
if(roomPosition[0]==6 &&roomPosition[1]==6){return;}
if(sRand.Range(0,100)<33){
for(int r = 0; r < 11; ++r){
for(int c = 0; c < 11; ++c){
float rate = 100.0f/(4);
float firstDisparity = Mathf.Abs(((10)/2)-r)*rate;
float secondDisparity = Mathf.Abs(((10)/2)-c)*rate;
double chance = (double)(100-(firstDisparity+secondDisparity));
if(chance <0)
{
rockMatrix[r,c] = 0;
}else{
rockMatrix[r,c] = chance;
}
}
}
for(int r = 0; r < 10; ++r){
for(int c = 0; c < 10; ++c){
if(sRand.Range(0,100)<rockMatrix[r,c])
{
roomMatrix[r,c] = 6;
}
}}}
}
示例3: doorToNextFloor
void doorToNextFloor(Seed sRand)
{
//randomly choose a room that isn't the starting room and add a door.
for(int i=0;i<11;i++){
for(int m=0;m<11;m++)
{
if(layout[i,m] !=null)
{
if(i!=6&&m!=6)
{
if(sRand.Range(0,100)<99)
{
Debug.Log(i+" "+m);
layout[i,m].hasDoor = true;
layout[i,m].roomMatrix[5,5] = 7;
return;
}
}
}
}
}
}