本文整理汇总了C#中Phase.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Phase.ToString方法的具体用法?C# Phase.ToString怎么用?C# Phase.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phase
的用法示例。
在下文中一共展示了Phase.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStringTest
public void ToStringTest()
{
var complex = new Complex(3.1, 2.5);
var exp = new Phase(new ComplexNumber(complex));
Assert.Equal("phase(3.1+2.5i)", exp.ToString());
}
示例2: GetInput
private static InputResult GetInput(GameObject gameObject, Phase phase)
{
InputResult result = new InputResult();
#if UNITY_ANDROID
if (Input.touchCount > 0)
{
for(int i = 0; i < Input.touchCount; i++)
{
Touch currentTouch = Input.GetTouch(i);
if (validateInput(gameObject, currentTouch.position))
{
switch (phase)
{
case Phase.BEGAN:
result.Input = currentTouch.phase == TouchPhase.Began;
break;
case Phase.MOVED:
result.Input = currentTouch.phase == TouchPhase.Moved;
break;
case Phase.ENDED:
result.Input = currentTouch.phase == TouchPhase.Ended;
break;
default:
throw new System.ArgumentException("Incorrect InputExtensions.Phase " + phase.ToString());
}
}
result.InputId = currentTouch.fingerId;
result.Position = currentTouch.position;
}
}
#endif
#if UNITY_WEBPLAYER || UNITY_EDITOR
if (validateInput(gameObject, Input.mousePosition))
{
switch (phase)
{
case Phase.BEGAN:
result.Input = Input.GetMouseButtonDown(0);
break;
case Phase.MOVED:
result.Input = Input.GetMouseButton(0);
break;
case Phase.ENDED:
result.Input = Input.GetMouseButtonUp(0);
break;
default:
throw new System.ArgumentException("Incorrect InputExtensions.Phase " + phase.ToString());
}
}
result.Position = Input.mousePosition;
#endif
return result;
}