Exemplo n.º 1
0
        private void PickPosition()
        {
            TouchGameSettings settings = TouchGameSettings.settings();

            m_position.x = m_rand.Next(settings.areaWidth) - settings.areaWidth / 2;
            m_position.z = m_rand.Next(settings.areaHeight);
            gameObject.transform.localPosition = m_position;
        }
Exemplo n.º 2
0
        void Update()
        {
            TouchGameSettings settings = TouchGameSettings.settings();
            float             l        = 1.0f;                                                  //Time.deltaTime * 5.0f;
            float             nx       = m_gamepad.axes[HFTGamepad.AXIS_TOUCH_X] * 0.5f;        // -0.5 <-> 0.5
            float             ny       = m_gamepad.axes[HFTGamepad.AXIS_TOUCH_Y] * 0.5f + 0.5f; //    0 <-> 1

            m_position.x = Mathf.Lerp(m_position.x, settings.areaWidth * nx, l);
            m_position.z = Mathf.Lerp(m_position.z, settings.areaHeight - (ny * settings.areaHeight) - 1, l); // because in 2D down is positive.

            gameObject.transform.localPosition = m_position;
        }