当前位置: 首页>>代码示例>>C#>>正文


C# Vector3.Equals方法代码示例

本文整理汇总了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;
                }

            }
        }
开发者ID:gamingexpx12,项目名称:Polaris4x,代码行数:70,代码来源:RTS_Camera.cs

示例2: needUpdate

        protected bool needUpdate()
        {
            m_lastMousePos = m_curMousePos;
            m_curMousePos = Input.mousePosition;

            if(m_lastMousePos.Equals(m_curMousePos))
            {
                return false;
            }

            return true;
        }
开发者ID:zhutaorun,项目名称:unitygame,代码行数:12,代码来源:AttackArrow.cs


注:本文中的UnityEngine.Vector3.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。