本文整理汇总了C#中UnityEngine.Vector3.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Equals方法的具体用法?C# Vector3.Equals怎么用?C# Vector3.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Vector3
的用法示例。
在下文中一共展示了Vector3.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Move
/// <summary>
/// Move camera with keyboard or with screen edge, emphasis on OR.
/// </summary>
private void Move()
{
if (useKeyboardInput && KeyboardInput != Vector2.zero)
{
Vector3 desiredMove = new Vector3(KeyboardInput.x, 0, KeyboardInput.y);
desiredMove *= keyboardMovementSpeed;
desiredMove *= Time.deltaTime;
desiredMove = Quaternion.Euler(new Vector3(0f, transform.eulerAngles.y, 0f)) * desiredMove;
desiredMove = m_Transform.InverseTransformDirection(desiredMove);
m_Transform.Translate(desiredMove, Space.Self);
//Debug
if (!desiredMove.Equals(Vector3.zero))
{
keyboardMove = true;
}
else
{
keyboardMove = false;
}
}
else if (usePanning && Input.GetKey(panningKey) /*&& MouseAxis != Vector2.zero*/)
{
Vector3 desiredMove = new Vector3(-MouseAxis.x, 0, -MouseAxis.y);
desiredMove *= panningSpeed;
desiredMove *= Time.deltaTime;
desiredMove = Quaternion.Euler(new Vector3(0f, transform.eulerAngles.y, 0f)) * desiredMove;
desiredMove = m_Transform.InverseTransformDirection(desiredMove);
m_Transform.Translate(desiredMove, Space.Self);
//Debug
panningMove = true;
}
else if (useScreenEdgeInput)
{
Vector3 desiredMove = new Vector3();
Rect leftRect = new Rect(0, 0, screenEdgeBorder, Screen.height);
Rect rightRect = new Rect(Screen.width - screenEdgeBorder, 0, screenEdgeBorder, Screen.height);
Rect upRect = new Rect(0, Screen.height - screenEdgeBorder, Screen.width, screenEdgeBorder);
Rect downRect = new Rect(0, 0, Screen.width, screenEdgeBorder);
desiredMove.x = leftRect.Contains(MouseInput) ? -1 : rightRect.Contains(MouseInput) ? 1 : 0;
desiredMove.z = upRect.Contains(MouseInput) ? 1 : downRect.Contains(MouseInput) ? -1 : 0;
desiredMove *= screenEdgeMovementSpeed;
desiredMove *= Time.deltaTime;
desiredMove = Quaternion.Euler(new Vector3(0f, transform.eulerAngles.y, 0f)) * desiredMove;
desiredMove = m_Transform.InverseTransformDirection(desiredMove);
m_Transform.Translate(desiredMove, Space.Self);
//Debug
if (desiredMove != Vector3.zero)
{
mouseMove = true;
}
}
}
示例2: needUpdate
protected bool needUpdate()
{
m_lastMousePos = m_curMousePos;
m_curMousePos = Input.mousePosition;
if(m_lastMousePos.Equals(m_curMousePos))
{
return false;
}
return true;
}