本文整理汇总了C#中Voxel.GetVariant方法的典型用法代码示例。如果您正苦于以下问题:C# Voxel.GetVariant方法的具体用法?C# Voxel.GetVariant怎么用?C# Voxel.GetVariant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voxel
的用法示例。
在下文中一共展示了Voxel.GetVariant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
Voxel v = new Voxel();
// Theme: 5 bits
// Block: 5 bits
// Variant: 6 bits
// Rotation x: 2 bits
// Rotation y: 2 bits
// Rotation z: 2 bits
string theme = "11111";
string block = "11111";
string variant = "111111";
string rotX = "11";
string rotY = "01";
string rotZ = "00";
string data = theme + block + variant + rotX + rotY + rotZ;
v.data = Convert.ToInt32(data, 2);
Debug.Log("Raw data: "+v.data);
Debug.Log("Binary data: "+ v.GetBinaryString());
// Change theme from space to western
Debug.Log("Theme: "+v.GetTheme());
Debug.Log("Set theme: Theme.DEFAULT");
v.SetTheme(Theme.DEFAULT);
Debug.Log("Binary data: "+v.GetBinaryString());
Debug.Log("Theme: "+v.GetTheme());
Debug.Log("BlockID: "+v.GetBlockType());
Debug.Log("Set block ID: 0");
v.SetBlockType(0);
Debug.Log("Binary data: "+v.GetBinaryString());
Debug.Log("BlockID NEW: "+v.GetBlockType());
Debug.Log("Variant before: "+v.GetVariant());
Debug.Log("Set variant: 2");
v.SetVariant(2);
Debug.Log("Binary data: "+v.GetBinaryString());
Debug.Log("Variant after: "+v.GetVariant());
Debug.Log("Rotation before: "+v.GetRotation().eulerAngles);
Debug.Log("Set rotation: 270, 0, 0");
v.SetRotation(Quaternion.Euler(270f, 0f, 0f));
Debug.Log("Binary data: "+v.GetBinaryString());
Debug.Log("Rotation after: "+v.GetRotation().eulerAngles);
}