示例#1
0
        void Awake()
        {
            try
            {
#if ENABLE_VRIK
                this.avatar               = this.avatarForFinalIK;
                this.head                 = this.headForFinalIK;
                this.body                 = this.bodyForFinalIK;
                this.LeftHand             = this.LeftHandForFinalIK;
                this.rightHand            = this.rightHandForFinalIK;
                this.noticePanelForAvatar = this.noticePanelForFinalIKAvatar;
                this.noticeTextForAvatar  = this.noticeTextForFinalIKAvatar;
#else
                this.avatar               = this.avatarForSimpleIK;
                this.head                 = this.headForSimpleIK;
                this.body                 = this.bodyForSimpleIK;
                this.LeftHand             = this.LeftHandForSimpleIK;
                this.rightHand            = this.rightHandForSimpleIK;
                this.noticePanelForAvatar = this.noticePanelForSimpleIKAvatar;
                this.noticeTextForAvatar  = this.noticeTextForSimpleIKAvatar;
#endif
                // Practice mode
                if (HumanNaviConfig.Instance.configInfo.executionMode == (int)ExecutionMode.Practice)
                {
                    this.isPracticeMode = true;
                }

                // Playback system
                this.playbackRecorder = this.playbackManager.GetComponent <HumanNaviPlaybackRecorder>();

                // Avatar
                this.initialAvatarPosition = this.avatar.transform.position;
                this.initialAvatarRotation = this.avatar.transform.eulerAngles;

                // GUI
                this.mainMenu            = GameObject.FindGameObjectWithTag("MainMenu");
                this.panelMainController = mainMenu.GetComponent <PanelMainController>();

                this.noticePanelForAvatar.SetActive(false);
                this.noticeTextForAvatar.text = "";

                // MessageMap
                this.receivedMessageMap = new Dictionary <string, bool>();
                this.receivedMessageMap.Add(MsgIamReady, false);
                this.receivedMessageMap.Add(MsgGetAvatarStatus, false);
                this.receivedMessageMap.Add(MsgGetObjectStatus, false);
                this.receivedMessageMap.Add(MsgGetSpeechState, false);
                this.receivedMessageMap.Add(MsgGiveUp, false);

                // Timer
                this.stepTimer = new StepTimer();
            }
            catch (Exception exception)
            {
                Debug.LogError(exception);
                SIGVerseLogger.Error(exception.Message);
                SIGVerseLogger.Error(exception.StackTrace);
                this.ApplicationQuitAfter1sec();
            }
        }
示例#2
0
        private void CheckGraspingStatus(NewtonVR.NVRHand hand)
        {
            if (hand.HoldButtonDown)
            {
                SIGVerseLogger.Info("HandInteraction" + "\t" + "HoldButtonDown" + "\t" + hand.name + "\t" + this.GetElapsedTimeText());
                this.RecordEventLog("HandInteraction" + "\t" + "HoldButtonDown" + "\t" + hand.name);
            }

            if (hand.HoldButtonUp)
            {
                string objectInhand = "";
                if (hand.IsLeft)
                {
                    objectInhand = this.objectIdInLeftHandPreviousFrame;
                }
                else if (hand.IsRight)
                {
                    objectInhand = this.objectIdInRightHandPreviousFrame;
                }

                if (objectInhand != "")
                {
                    SIGVerseLogger.Info("HandInteraction" + "\t" + "ReleaseObject" + "\t" + hand.name + "\t" + this.GetElapsedTimeText());
                    this.RecordEventLog("HandInteraction" + "\t" + "ReleaseObject" + "\t" + hand.name + "\t" + objectInhand);
                }
                else
                {
                    SIGVerseLogger.Info("HandInteraction" + "\t" + "HoldButtonUp" + "\t" + hand.name + "\t" + this.GetElapsedTimeText());
                    this.RecordEventLog("HandInteraction" + "\t" + "HoldButtonUp" + "\t" + hand.name);
                }
            }
        }
示例#3
0
        private void CheckGraspOfObject(NewtonVR.NVRHand hand)
        {
            if (hand.HoldButtonDown && hand.IsInteracting)
            {
                if (hand.CurrentlyInteracting.tag == TagNameOfGraspables)
                {
                    if (this.IsTargetObject(hand.CurrentlyInteracting.name))
                    {
                        if (!this.isTargetAlreadyGrasped)
                        {
                            SIGVerseLogger.Info("Target object is grasped" + "\t" + this.GetElapsedTimeText());

                            this.SendPanelNotice("Target object is grasped", 100, PanelNoticeStatus.Green);

                            this.scoreManager.AddScore(Score.ScoreType.CorrectObjectIsGrasped);
                            //this.scoreManager.AddTimeScoreOfGrasp();
                            this.scoreManager.AddTimeScore();

                            this.isTargetAlreadyGrasped = true;
                        }

                        this.RecordEventLog("Object_Is_Grasped" + "\t" + "Target_Object" + "\t" + hand.CurrentlyInteracting.name);
                    }
                    else
                    {
                        //if (!this.isTargetAlreadyGrasped)
                        {
                            if (!this.alreadyGraspedObjects.Contains(hand.CurrentlyInteracting.name))
                            {
                                SIGVerseLogger.Info("Wrong object is grasped [new]" + "\t" + this.GetElapsedTimeText() + "\t" + this.GetElapsedTimeText());

                                this.SendPanelNotice("Wrong object is grasped", 100, PanelNoticeStatus.Red);

                                this.scoreManager.AddScore(Score.ScoreType.IncorrectObjectIsGrasped);
                                //this.scoreManager.ImposeTimePenalty(Score.TimePnaltyType.IncorrectObjectIsGrasped);

                                //this.countWrongObjectsGrasp++;

                                this.alreadyGraspedObjects.Add(hand.CurrentlyInteracting.name);
                            }
                            else
                            {
                                SIGVerseLogger.Info("Wrong object is grasped [already grasped]" + "\t" + this.GetElapsedTimeText() + "\t" + this.GetElapsedTimeText());
                            }

                            this.RecordEventLog("Object_Is_Grasped" + "\t" + "Wrong_Object" + "\t" + hand.CurrentlyInteracting.name);
                        }
                    }
                }
                else                // if (hand.CurrentlyInteracting.tag != "Untagged")
                {
                    SIGVerseLogger.Info("Object_Is_Grasped" + "\t" + "Others" + "\t" + hand.CurrentlyInteracting.name + "\t" + this.GetElapsedTimeText());
                    this.RecordEventLog("Object_Is_Grasped" + "\t" + "Others" + "\t" + hand.CurrentlyInteracting.name);
                }
            }
        }
示例#4
0
        private void CheckHandInteraction(NewtonVR.NVRHand hand)
        {
            if (hand.IsInteracting)
            {
                if (hand.HoldButtonDown)
                {
                    if (hand.CurrentlyInteracting.tag == "Graspables")
                    {
                        this.RecordEventLog("Interaction" + "\t" + hand.name + ".IsGrasping" + "\t" + hand.CurrentlyInteracting + hand.CurrentlyInteracting.transform.position);

                        //string whichHandUsed = string.Empty;
                        //if      (hand.IsLeft)  { whichHandUsed = "LeftHand";  }
                        //else if (hand.IsRight) { whichHandUsed = "RightHand"; }

                        if (hand.CurrentlyInteracting.name == this.currentTaskInfo.target)
                        {
                            if (!this.isTargetAlreadyGrasped)
                            {
                                SIGVerseLogger.Info("Target object is grasped");

                                this.SendPanelNotice("Target object is grasped", 100, PanelNoticeStatus.Green);

                                this.scoreManager.AddScore(Score.Type.CorrectObjectIsGrasped);
                                this.scoreManager.AddTimeScoreOfGrasp();

                                this.isTargetAlreadyGrasped = true;
                            }
                        }
                        else
                        {
                            if (!this.isTargetAlreadyGrasped)
                            {
                                SIGVerseLogger.Info("Wrong object is grasped");

                                this.SendPanelNotice("Wrong object is grasped", 100, PanelNoticeStatus.Red);

                                this.scoreManager.AddScore(Score.Type.IncorrectObjectIsGrasped);
                            }
                        }
                    }
                }
            }
            else if (hand.HoldButtonDown)
            {
                this.RecordEventLog("Interaction" + "\t" + hand.name + ".HoldButtonDown");
            }
            else if (hand.IsHovering)
            {
                this.RecordEventLog("Interaction" + "\t" + hand.name + ".IsHovering");
            }
        }
示例#5
0
        private string GetGraspingObjectId(NewtonVR.NVRHand hand)
        {
            string graspingObject = "";

            if (hand.HoldButtonPressed)
            {
                if (hand.IsInteracting)
                {
                    if (hand.CurrentlyInteracting.tag == TagNameOfGraspables)
                    {
                        graspingObject = hand.CurrentlyInteracting.name;
                    }
                }
            }

            return(graspingObject);
        }