本文整理汇总了C#中Vector4.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.ToString方法的具体用法?C# Vector4.ToString怎么用?C# Vector4.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Vector4ToStringTest
public void Vector4ToStringTest()
{
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator;
CultureInfo enUsCultureInfo = new CultureInfo("en-US");
Vector4 v1 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);
string v1str = v1.ToString();
string expectedv1 = string.Format(CultureInfo.CurrentCulture
, "<{1:G}{0} {2:G}{0} {3:G}{0} {4:G}>"
, separator, 2.5, 2, 3, 3.3);
Assert.Equal(expectedv1, v1str);
string v1strformatted = v1.ToString("c", CultureInfo.CurrentCulture);
string expectedv1formatted = string.Format(CultureInfo.CurrentCulture
, "<{1:c}{0} {2:c}{0} {3:c}{0} {4:c}>"
, separator, 2.5, 2, 3, 3.3);
Assert.Equal(expectedv1formatted, v1strformatted);
string v2strformatted = v1.ToString("c", enUsCultureInfo);
string expectedv2formatted = string.Format(enUsCultureInfo
, "<{1:c}{0} {2:c}{0} {3:c}{0} {4:c}>"
, enUsCultureInfo.NumberFormat.NumberGroupSeparator, 2.5, 2, 3, 3.3);
Assert.Equal(expectedv2formatted, v2strformatted);
string v3strformatted = v1.ToString("c");
string expectedv3formatted = string.Format(CultureInfo.CurrentCulture
, "<{1:c}{0} {2:c}{0} {3:c}{0} {4:c}>"
, separator, 2.5, 2, 3, 3.3);
Assert.Equal(expectedv3formatted, v3strformatted);
}
示例2: Vector4_ToStringTest
public void Vector4_ToStringTest()
{
Vector4 v = new Vector4(1.0f, 2.2f, 3.33f, 4.444f);
Assert.AreEqual("Vector4(1, 2.2, 3.33, 4.444)", v.ToString());
}
示例3: ToStringTest
public void ToStringTest()
{
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-IE");
Assert.AreEqual("{X:-124 Y:352.234 Z:123.123 W:-108.3253}", c.ToString(), "#1");
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");
Assert.AreEqual("{X:-124 Y:352,234 Z:123,123 W:-108,3253}", c.ToString(), "#2");
Vector4 v = new Vector4(1324.2353252353223f, 1324.2353252353223f, 1324.2353252353223f, -108.325345f);
Assert.AreEqual("{X:1324,235 Y:1324,235 Z:1324,235 W:-108,3253}", v.ToString(), "#3");
}
示例4: SetVector4
/**
* This will save the datatype value inside the register, with a string
* key to identify and retrieve it. This will override any previous key
*/
public static void SetVector4 (string key, Vector4 value)
{
SetString(key, value.ToString());
}
示例5: should_print_vector_to_string
public void should_print_vector_to_string()
{
Vector4 v = new Vector4(1, 2, 3, 4);
Assert.That(v.ToString(), Iz.EqualTo("1.000000 2.000000 3.000000 4.000000"));
}
示例6: ToString
public new void ToString()
{
var vector = new Vector4(1.1f, 2.2f, 3.3f, 4.4f);
Assert.AreEqual("X: 1.1 Y: 2.2 Z: 3.3 W: 4.4", vector.ToString());
}
示例7: Add
public static WWWForm Add(this WWWForm form, string key, Vector4 value)
{
form.AddField(key, value.ToString());
return form;
}
示例8: UpdatePlayerFourDPosition
/**
* The FirstPersonController knows in which direction the player goes in 3D.
* The GameEngine knows which 3D space is actually displayed.
*
* This method updates the 4D position of the player, depending on which 3D space he's in.
* */
public void UpdatePlayerFourDPosition(float right, float up, float forward)
{
Vector4 deltaCoordinates = new Vector4 (right, up, forward, 0);
Matrix4x4 transformMatrix = new Matrix4x4 ();
transformMatrix.SetColumn (0, fourDLevelRight);
transformMatrix.SetColumn (1, fourDLevelUp);
transformMatrix.SetColumn (2, fourDLevelForward);
transformMatrix.SetColumn (3, Vector4.zero);
fourDPlayerPosition += transformMatrix * deltaCoordinates;
Debug.Log ("New 4D Coordinates = " + fourDPlayerPosition.ToString ());
}