Пример #1
0
    // wake the sphere
    void PushStart(InputHandler input)
    {
        // Remove the any key listener
        InputEvent.RemoveListener(anyKeyListener);

        // Register a listener for more from the same keyboard key
        key = ((InputHandlerKey)input).key;
        InputEvent.AddListenerKey(key, PushUp, null);

        // Register a listener function for pointer event (click or touch start)
        InputEvent.AddListenerTouchOrMouse(PushUp, null, null);

        // wake the ball
        started = true;
        sphere.GetComponent <Rigidbody>().AddForce(Vector3.right * 5, ForceMode.VelocityChange);
    }