Example #1
0
 public void onTurnStep()
 {
     if (idPlayer == logicGame.currentPlayer)
     {
         notificationsMannager.lightStepNotification(0);
         handLogic.allowToGrab = true;
     }
     else
     {
         handLogic.allowToGrab = false;
         notificationsMannager.lightStepNotification(7);
     }
 }
    // Update is called once per frame

    void Update()
    {
        if (!isDemo)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            //if(OVRInput.GetDown(OVRInput.Button.One))
            {
                if (!started)
                {
                    started = true;

                    currentStage  = EXP_STAGE.TUTORIAL;
                    stagesDone[0] = true;

                    notificationsMannager.lightStepNotification(1);

                    if (notificacionTextObject != null)
                    {
                        TextMesh text = notificacionTextObject.GetComponent <TextMesh>();
                        text.text = "TUTORIAL";
                    }

                    if (persistanceManager != null)
                    {
                        persistanceManager.saveGeneral();
                    }
                    else
                    {
                        Debug.LogError("PersistanceMannager missing!!! No results reported");
                    }
                    //Call persistance to update
                }
                else
                {
                    nextStage();
                }

                trackerMannager.setTrackers();
            }
            else if (Input.GetKeyDown(KeyCode.R))
            {
                setNew();
                notificationsMannager.normalSettings();
                persistanceManager.recording = false;

                GameObject leftProp = GameObject.Find("LeftProp");
                if (leftProp != null)
                {
                    leftProp.GetComponent <PropController>().angleNumber = 0;
                }

                GameObject rightProp = GameObject.Find("RightProp");
                if (rightProp != null)
                {
                    rightProp.GetComponent <PropController>().angleNumber = 0;
                }
            }
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        persistanceManager    = gameObject.GetComponent <PersistanceManager>();
        trackerMannager       = gameObject.GetComponent <TrackerMannager>();
        notificationsMannager = gameObject.GetComponent <NotificationsMannager>();
        surveyMannager        = gameObject.GetComponent <SurveyMannager>();
        logic = gameObject.GetComponent <Logic>();

        surveyActivated = false;

        if (!isDemo)
        {
            setNew();
        }
        else
        {
            currentStage = EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING;
            notificationsMannager.lightStepNotification(1);
            started = true;
            if (notificacionTextObject != null)
            {
                TextMesh text = notificacionTextObject.GetComponent <TextMesh>();
                text.text = "Welcome!!";
            }
            if (persistanceManager != null)
            {
                persistanceManager.storeLocal   = false;
                persistanceManager.storeInForms = false;
            }
            trackerMannager.setTrackers();
        }



        //Debug.Log("-----------Waiting---------");
    }
Example #4
0
    public void setNew()
    {
        handOnObject = false;
        goal         = 0;
        showing      = false;
        stage        = -1;



        if (logicGame != null)
        {
            idPlayer              = Int32.Parse(gameObject.name.ToCharArray()[gameObject.name.Length - 1] + "");
            homePosition          = logicGame.homePositions[idPlayer];
            homePosition2         = logicGame.homePositions2[idPlayer];
            positions             = logicGame.positions;
            objects               = logicGame.objects;
            onTurn                = (idPlayer == logicGame.currentPlayer);
            notificationsMannager = GameObject.Find("Instructions Player " + idPlayer).GetComponent <NotificationsMannager>();
            notificationsMannager.lightStepNotification(7);
        }
        trackerMannager.setTrackers();
        //fillPlayerInformation();
        fillPlayerInformationFull();
    }
Example #5
0
    // It controls ALL the movements. The trigger is actionated by the Master for each pressed trigger done by the user
    // To every task completly, it has to start in point Z (InitialStatus Object). The process as follow
    // Stage starts at 0.
    // If hand in initialstatus and trigger. Initialstatus object dissapears, the object to pick shows up. Stage = 0
    // When object picked, Second trigger shadow for next movement appears. Stage = 1
    // when object realeased, then trigger, shadows dissapear for pioint zero and appears in starts position. Stage = 2
    // When object in initial position and trigger objects dissapears and user move hand back to point zero. Stage = 3
    // When hand in initial position and trigger, movements ends. Stage = -1
    public void reGoal()
    {
        if (conditionsToProceed(stage))
        {
            if (stage == -1)
            {
                initialPoint.SetActive(true);
                stage = 0;
            }
            else if (stage == 0) // Hand in point Zero. Pre. No object to pick. Pos Object showed up initial position.
            {
                int nGoal;
                while ((nGoal = Random.Range(0, 2)) == goal)
                {
                    ;
                }

                goal = nGoal;
                //goal = 0;

                this.propContr = props[goal].GetComponent <PropController>();



                //TODO trackers. How mannage 3 trackers. This part should dissapear since all trackers should be in the scene so we should not need to look for the tracker everytime

                /* GameObject tracker1 = GameObject.Find("Tracker1");
                 * if(tracker1 != null)
                 * {
                 *   HydraTracker hTracker = tracker1.GetComponent<HydraTracker>();
                 *   if(hTracker != null)
                 *   {
                 *       //hTracker.attach(propContr);
                 *       hTracker.PositionReference = this.propContr;
                 *       if (masterController.currentStage != MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING)
                 *       {
                 *           hTracker.attach();
                 *       }
                 *
                 *   }
                 * }*/

                GameObject PositionReference = propContr.positionReference;
                targetedController.starShifting(PositionReference.transform.position, capsuleHand.GetLeapHand().PalmPosition.ToVector3()); //Capsulehand has a simplified methos for giving the hand. does not work here?
                if (masterController.currentStage == MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING || masterController.currentStage == MasterController.EXP_STAGE.PROP_NOT_MATCHING_PLUS_RETARGETING)
                {
                    props[goal].transform.position = targetedController.retargetedPosition.transform.position;
                }
                else
                {
                    props[goal].transform.position = PositionReference.transform.position;
                }
                StartCoroutine(pairTracker(1, this.propContr));

                persistanceManager.trackedObject = this.propContr;
                //props[goal].SetActive(true);
                persistanceManager.startDocking(stage);
                initialPoint.SetActive(false);
                stage = 1;
            }
            else if (stage == 1) // Hand in object Maybe should check the coliders are overlapped. Pre No shadow in scene. Pos shadow in point Z
            {
                persistanceManager.saveDocking();
                propContr.dockProp.SetActive(true);
                persistanceManager.startDocking(stage);
                stage = 2;
            }
            else if (stage == 2) // Object moved in desired position i point Z. Pre Shadow in point Z. Pos shadow in initial position
            {
                persistanceManager.saveDocking();
                propContr.movePropDock(false);
                persistanceManager.startDocking(stage);
                stage = 3;
            }
            else if (stage == 3) // Object moved to initial position in desired orientation. Pre. Shadow on, initial status off. Pos Shadow off, initial position on
            {
                persistanceManager.saveDocking();
                propContr.dockProp.SetActive(false);
                initialPoint.SetActive(true);
                persistanceManager.startDocking(stage);

                /*
                 * GameObject tracker1 = GameObject.Find("Tracker1");
                 * if (tracker1 != null)
                 * {
                 *  HydraTracker hTracker = tracker1.GetComponent<HydraTracker>();
                 *  if (hTracker != null)
                 *  {
                 *      //hTracker.attach(propContr);
                 *      hTracker.PositionReference = this.propContr;
                 *      if (masterController.currentStage != MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING)
                 *      {
                 *          hTracker.detach();
                 *      }
                 *
                 *  }
                 * }
                 */

                capsuleHand.canDraw = true;
                propContr.hydraTracker.detach();
                propContr.gameObject.SetActive(false);

                stage = 4;
            }
            else if (stage == 4) // Hand moves to point z
            {
                persistanceManager.saveDocking();
                persistanceManager.startDocking(stage);
                initialPoint.SetActive(false);
                capsuleHand.canDraw = true;
                stage = -1;
                propContr.hydraTracker.detach();
                if (!masterController.isDemo)
                {
                    if (propContr.angleNumber == 2)
                    {
                        notificationsMannager.registerGoal();
                    }
                }
            }

            notificationsMannager.lightStepNotification(stage + 2);
        }
    }