Пример #1
0
    // Use this for initialization
    void Start()
    {
        m_gestures = GetComponent <CMobile3dGestures>();
        m_gestures.HandleGesture += ProcessGesture;
        m_gestures.Begin();

        gameObject.OnTriggerEnterAsObservable()
        .Delay(System.TimeSpan.FromSeconds(0.5f))
        .TakeUntil(gameObject.OnTriggerExitAsObservable())
        .RepeatUntilDestroy(this)
        .Subscribe(_ =>
        {
            c = _;
            _.GetComponent <MeshRenderer>().material.color = Color.red;
            isCatchPossible = true;
        });

        gameObject.OnTriggerExitAsObservable()
        .Delay(System.TimeSpan.FromSeconds(0.2f))
        .Subscribe(_ =>
        {
            _.GetComponent <MeshRenderer>().material.color = Color.white;
            isCatchPossible = false;
        });
    }
        private void Start()
        {
            m_gestures     = GetComponent <CMobile3dGestures>();
            m_ball         = GameObject.Find("Ball").GetComponent <Rigidbody>();
            m_rotateCamera = GameObject.Find("RotateCamera").transform;
            m_instructions = GameObject.Find("Canvas/Instructions");

            // Set faster update interval for the gyro.  This should make the gesture detection more accurate.
            m_gestures.HandleGesture += ProcessGesture;
            m_gestures.Begin();
        }
Пример #3
0
        void Start()
        {
            m_gestures     = GetComponent <CMobile3dGestures>();
            m_instructions = GameObject.Find("Canvas/Instructions");
            m_left         = GameObject.Find("Canvas/Left").GetComponent <CColorFadeTimer>();
            m_right        = GameObject.Find("Canvas/Right").GetComponent <CColorFadeTimer>();
            m_back         = GameObject.Find("Canvas/Back").GetComponent <CColorFadeTimer>();
            m_forward      = GameObject.Find("Canvas/Forward").GetComponent <CColorFadeTimer>();
            m_down         = GameObject.Find("Canvas/Down").GetComponent <CColorFadeTimer>();
            m_up           = GameObject.Find("Canvas/Up").GetComponent <CColorFadeTimer>();

            m_gestures.HandleGesture += ProcessGesture;
            m_gestures.Begin();
        }
Пример #4
0
        private void Start()
        {
            m_gestures = GetComponent <CMobile3dGestures>();

            m_instructions        = GameObject.Find("Canvas/Instructions");
            m_optionsPanel        = GameObject.Find("Canvas/Options").GetComponent <RectTransform>();
            m_coordSysDeviceBtn   = GameObject.Find("Canvas/Options/CoordSys/Device").GetComponent <Button>();
            m_coordSysWorldXZBtn  = GameObject.Find("Canvas/Options/CoordSys/WorldXZ").GetComponent <Button>();
            m_coordSysWorldXYZBtn = GameObject.Find("Canvas/Options/CoordSys/WorldXYZ").GetComponent <Button>();
            m_gesturesToggle      = GameObject.Find("Canvas/Options/Gestures/Toggle").GetComponent <Toggle>();
            m_mag02Btn            = GameObject.Find("Canvas/Options/Gestures/02g").GetComponent <Button>();
            m_mag04Btn            = GameObject.Find("Canvas/Options/Gestures/04g").GetComponent <Button>();
            m_mag10Btn            = GameObject.Find("Canvas/Options/Gestures/10g").GetComponent <Button>();
            m_mag20Btn            = GameObject.Find("Canvas/Options/Gestures/20g").GetComponent <Button>();
            m_snapToAxisToggle    = GameObject.Find("Canvas/Options/Gestures/SnapToAxis").GetComponent <Toggle>();
            m_showAccelToggle     = GameObject.Find("Canvas/Options/ShowAccel").GetComponent <Toggle>();
            m_smartphone          = GameObject.Find("DeviceOrientation/Smartphone").transform;
            m_rotateCamera        = GameObject.Find("RotateCamera").transform;

#if !DEBUG
            m_recordButton = GameObject.Find("Canvas/Options/Record");
            m_recordButton.SetActive(false);
#endif

            m_colorBlockUnselected           = m_coordSysDeviceBtn.colors;
            m_colorBlockSelected             = m_colorBlockUnselected;
            m_colorBlockSelected.normalColor = Color.cyan;
            ChangeCoordSys(0);
            ChangeMagnitude(0.4f);

            m_optionsPanel.gameObject.SetActive(false);

            Transform accelBall = transform.Find("AccelBall");
            m_accelBallPool = new CSimpleTransformPool(accelBall, 100);

            Transform gestureRod = transform.Find("GestureRod");
            m_gestureRodPool = new CSimpleTransformPool(gestureRod, 10);

            // Set faster update interval for the gyro.  This should make the gesture detection more accurate.
            m_gestures.HandleGesture += ProcessGesture;
            m_gestures.Begin();

            Button resetGyro = GameObject.Find("Canvas/ResetGyro").GetComponent <Button>();
            resetGyro.interactable = m_gestures.HasGyroscope;
        }
Пример #5
0
 public override void Start()
 {
     m_gestures = GetComponent <CMobile3dGestures>();
 }