本文整理汇总了C#中World.playSoundEffect方法的典型用法代码示例。如果您正苦于以下问题:C# World.playSoundEffect方法的具体用法?C# World.playSoundEffect怎么用?C# World.playSoundEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.playSoundEffect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (world.getBlockId(i, j, k) == Block.snow.blockID)
{
l = 0;
}
else
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
}
if (itemstack.stackSize == 0)
{
return false;
}
if (world.canBlockBePlacedAt(blockID, i, j, k, false))
{
Block block = Block.blocksList[blockID];
if (world.setBlockAndMetadataWithNotify(i, j, k, blockID, getMetadata(itemstack.getItemDamage())))
{
Block.blocksList[blockID].onBlockPlaced(world, i, j, k, l);
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F,
block.stepSound.func_737_c(), (block.stepSound.func_738_a() + 1.0F)/2.0F,
block.stepSound.func_739_b()*0.8F);
itemstack.stackSize--;
}
}
return true;
}
示例2: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
int i1 = world.getBlockId(i, j, k);
Material material = world.getBlockMaterial(i, j + 1, k);
if (!material.isSolid() && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
{
Block block = Block.tilledField;
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, block.stepSound.func_737_c(),
(block.stepSound.func_738_a() + 1.0F)/2.0F, block.stepSound.func_739_b()*0.8F);
if (world.singleplayerWorld)
{
return true;
}
world.setBlockWithNotify(i, j, k, block.blockID);
itemstack.damageItem(1);
if (world.rand.nextInt(8) == 0 && i1 == Block.grass.blockID)
{
int j1 = 1;
for (int k1 = 0; k1 < j1; k1++)
{
float f = 0.7F;
float f1 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
float f2 = 1.2F;
float f3 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
var entityitem = new EntityItem(world, i + f1, j + f2, k + f3,
new ItemStack(seeds));
entityitem.delayBeforeCanPickup = 10;
world.entityJoinedWorld(entityitem);
}
}
return true;
}
else
{
return false;
}
}
示例3: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
int i1 = world.getBlockId(i, j, k);
if (i1 == 0)
{
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F,
itemRand.nextFloat()*0.4F + 0.8F);
world.setBlockWithNotify(i, j, k, Block.fire.blockID);
}
itemstack.damageItem(1);
return true;
}
示例4: blockActivated
public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
if (world.singleplayerWorld)
{
return true;
}
int l = world.getBlockMetadata(i, j, k);
int i1 = l & 7;
int j1 = 8 - (l & 8);
world.setBlockMetadataWithNotify(i, j, k, i1 + j1);
world.markBlocksDirty(i, j, k, i, j, k);
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "random.click", 0.3F,
j1 <= 0 ? 0.5F : 0.6F);
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
if (i1 == 1)
{
world.notifyBlocksOfNeighborChange(i - 1, j, k, blockID);
}
else if (i1 == 2)
{
world.notifyBlocksOfNeighborChange(i + 1, j, k, blockID);
}
else if (i1 == 3)
{
world.notifyBlocksOfNeighborChange(i, j, k - 1, blockID);
}
else if (i1 == 4)
{
world.notifyBlocksOfNeighborChange(i, j, k + 1, blockID);
}
else
{
world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
}
return true;
}