Пример #1
0
 void Start()
 {
     r = UnityEngine.Random.value;
     //es = GameObject.Find ("EventSpawner").GetComponent<EventSpawner> ();
     sm = GameObject.Find("SettingsManager").GetComponent <SettingsManager> ();
     ig = gameObject.GetComponentInParent <IgEvent> ();
     EventManager.StartListening("UpdateLine", updateLineListener);
     UpdateLine();
 }
Пример #2
0
 void Start()
 {
     //es = GameObject.Find ("EventSpawner").GetComponent<EventSpawner> ();
     sm = GameObject.Find("SettingsManager").GetComponent <SettingsManager> ();
     id = int.Parse(gameObject.name.Substring(6));
     ig = gameObject.GetComponentInParent <IgEvent> ();
     EventManager.StartListening("UpdateDots", updateDotsListener);
     EventManager.StartListening("UpdateLine", updateLineListener);
     UpdateDots();
     UpdateLine();
 }
Пример #3
0
    bool CreateEvent(FileInfo i)
    {
        DeleteAllEvents();
        GameObject igEventObj = new GameObject();

        igEventObj.name = "IgEvent";
        igEventObj.tag  = "IgEvent";
        IgEvent ige = igEventObj.AddComponent <IgEvent> ();

        ige.dotShape   = dotShape;
        ige.cone       = cone;
        ige.mat        = mat;
        ige.met        = met;
        ige.proton     = proton;
        ige.electron   = electron;
        ige.lightGreen = lightGreen;
        ige.darkGreen  = darkGreen;
        return(ige.parseExtras(i));
    }
        void HandAttachedUpdate(Hand hand)
        {
            IE = GameObject.Find("IgEvent").GetComponent <IgEvent> ();
            //int fps = IE.GetFPS ();
            touchpad = hand.controller.GetAxis();
            //float midDist = Vector2.Distance (Vector2.zero, touchpad);
            float topDist = Vector2.Distance(new Vector2(0, 1 - buttonSize), touchpad);
            float botDist = Vector2.Distance(new Vector2(0, -1 + buttonSize), touchpad);

            //float rightDist = Vector2.Distance (new Vector2(0,1-buttonSize), touchpad);
            //float leftDist = Vector2.Distance (new Vector2(0,-1+buttonSize), touchpad);

            //switch mode by pressing the top button

/*			if (hand.controller.GetPressDown (Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)) {
 *                              if (-buttonSize < topDist && topDist < buttonSize) {
 *                                      if (mode < 1) {
 *                                              mode++;
 *                                      } else {
 *                                              mode = 0;
 *                                      }
 *                              }
 *                      }
 */
/*			if (mode == 0) {
 *                              if (hand.controller.GetPress (Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)) {
 *                                      if (-buttonSize > touchpad.x) {
 *                                              if (currentFrame - 1 >= 0) {
 *                                                      currentFrame -= 1;
 *                                                      int t = currentFrame;
 *                                                      IE.SetCurrentFrame (t);
 *                                                      if(!isPaused){
 *                                                              TogglePause ();
 *                                                      }
 *                                              }
 *                                      }else if (touchpad.x > buttonSize) {
 *                                              if (currentFrame + 1 <= sm.fps) {
 *                                                      currentFrame += 1;
 *                                                      int t = currentFrame;
 *                                                      IE.SetCurrentFrame (t);
 *                                                      if(!isPaused){
 *                                                              TogglePause ();
 *                                                      }
 *                                              }
 *                                      }
 *                              }
 *                      }else if (mode == 1) {
 */         if (hand.controller.GetTouch(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad))
            {
//					if(-1+buttonSize+buttonSize < touchpad.y && touchpad.y < 1-buttonSize-buttonSize){
                int t = (int)(((touchpad.x + 1f) / 2f) * sm.fps);
                IE.SetCurrentFrame(t);
                //Debug.Log(t);
//					}
            }
//			}

            //on pressing the pause button, toggle pause

/*			if (hand.controller.GetPressDown (Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)) {
 *                              if (-buttonSize < botDist && botDist < buttonSize) {
 *                                      TogglePause ();
 *                              }
 *                      }
 */

            /*
             * if (device.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu)){
             *	EventSpawner ES = GameObject.Find ("EventSpawner").GetComponent<EventSpawner> ();
             *	ES.IncRun ();
             *}
             * if (device.GetPressDown (SteamVR_Controller.ButtonMask.Touchpad)){
             *	EventSpawner ES = GameObject.Find ("EventSpawner").GetComponent<EventSpawner> ();
             *	ES.IncEvent ();
             *}
             */
        }