Example #1
0
 private void Start()
 {
     agent   = GameMaster.instance.GetPlayerMeshAgent();
     gaze    = GameMaster.instance.GetPlayerGaze();
     colisor = GetComponent <BoxCollider>();
     ClosePuzzle();
 }
Example #2
0
 private void Start()
 {
     gaze         = GameMaster.instance.GetPlayerGaze();
     inv          = GameMaster.instance.GetInventory();
     inventarioUI = inv.transform.gameObject;
     gm           = GameMaster.instance;
 }
Example #3
0
 private void Start()
 {
     agent = GameMaster.instance.GetPlayerMeshAgent();
     gaze  = GameMaster.instance.GetPlayerGaze();
     UpdateUI();
     ClosePuzzle();
 }
 // Use this for initialization
 void Start()
 {
     myGazeGetter   = FindObjectOfType <Gaze>();
     ballController = FindObjectOfType <BallController>();
     //every 20th of a second
     SetConfiguration(this.configuration);
 }
Example #5
0
            public Gaze Clone(int cloneFlags = 0)
            {
                var g = new Gaze();

                CopyTo(g, cloneFlags);
                return(g);
            }
Example #6
0
        /// <summary>
        /// Starts the engine, initializing input methods and supported commands
        /// </summary>
        /// <returns>An handle to wait on, that must be used to properly close the engine</returns>
        public EventWaitHandle Start()
        {
            // object used to await for terminate order
            var completion = new ManualResetEvent(false);

            // initialize input methods
            var gaze = new Gaze(50);

            gaze.Change += (InputMethod input, EventArgs evt) => {
                // reset recognized command to avoid triggering on the next position change
                Context.Recognized = null;
                Context.Position   = ((GazeChangeEventArgs)evt).Position;
                TriesCommands();
            };
            var voice = new Voice();

            voice.Change += (InputMethod input, EventArgs evt) => {
                Context.Recognized = ((PatternRecognizedEventArgs)evt).Recognized;
                TriesCommands();
            };
            InputMethods.Add(gaze);
            InputMethods.Add(voice);

            // initialize supported commands
            SupportedCommands.Add(new MousePosition());
            SupportedCommands.Add(new Calibrate(gaze.Engine));
            SupportedCommands.Add(new MouseLeftClick());
            SupportedCommands.Add(new MouseLeftDoubleClick());
            SupportedCommands.Add(new Cancel());
            SupportedCommands.Add(new Close());
            SupportedCommands.Add(new Dictate(voice.Speech));
            SupportedCommands.Add(new Quit(completion));

            return(completion);
        }
Example #7
0
    private void OnTriggerEnter(Collider other)
    {
        Gaze gaze = other.GetComponent <Gaze>();

        if (gaze != null)
        {
        }
    }
Example #8
0
    // Is called when the script instance is being loaded
    private void Awake()
    {
        controller = this;
        mainCamera = Camera.main;

        reticleBaseScale    = reticleCanvas.transform.localScale;
        reticleBaseDistance = Vector3.Distance(mainCamera.transform.position, reticleCanvas.transform.position);
    }
	void CheckGazeInputs()
	{
        if (!notebook.NoteBookIsOpen() && !Application.loadedLevelName.Equals("MainMenu"))
		{
			if(ScrollAreas.top.Contains(Gaze.Position()))		movement.turnDown();
			
			if(ScrollAreas.bottom.Contains(Gaze.Position()))	movement.turnUp();
		}
	}
Example #10
0
    private void OnTriggerExit(Collider other)
    {
        Gaze gaze = other.GetComponent <Gaze>();

        if (gaze != null)
        {
            gazeHeldTimeRemaining = gazeHeldTime;
            gazed = false;
        }
    }
Example #11
0
    private void Start()
    {
        for (int i = 0; i < 5; i++)
        {
            images[i].sprite = sprites[0];
        }

        colisor = GetComponent <BoxCollider>();
        agent   = GameMaster.instance.GetPlayerMeshAgent();
        gaze    = GameMaster.instance.GetPlayerGaze();
        ClosePuzzle();
    }
    private void OnTriggerExit(Collider other)
    {
        Gaze gaze = other.GetComponent <Gaze>();

        if (gaze != null)
        {
            gazeHeldTimeRemaining = gazeHeldTime;
            gazed = false;

            //Stop the montageplayer
            montagePlayer.Pause();
            Debug.Log("Paused video");
        }
    }
Example #13
0
    private void OnTriggerStay(Collider other)
    {
        Gaze gaze = other.GetComponent <Gaze>();

        if (gaze != null)
        {
            gazeHeldTimeRemaining -= Time.deltaTime;

            if (gazeHeldTimeRemaining <= 0)
            {
                ActivateGaze();
            }
        }
    }
Example #14
0
    private void OnTriggerStay(Collider other)
    {
        Gaze gaze = other.GetComponent <Gaze>();

        if (gaze != null)
        {
            gazeHeldTimeRemaining -= Time.deltaTime;

            if (gazeHeldTimeRemaining <= 0)
            {
                gazed = true;
                Debug.Log("Has gazed at the judge for " + gazeHeldTime + " seconds");
            }
        }
    }
Example #15
0
        private List <Gaze> translateGaze(List <Gaze> gazes)
        {
            List <Gaze> translated = new List <Gaze>();
            int         pictPosX   = PointToScreen(pictureBoxTexte.Location).X;
            int         pictPosY   = PointToScreen(pictureBoxTexte.Location).Y;

            foreach (Gaze item in gazes)
            {
                Gaze g = new Gaze();
                g       = item;
                g.gazeX = item.gazeX - pictPosX;
                g.gazeY = item.gazeY - pictPosY;
                translated.Add(g);
            }
            return(translated);
        }
Example #16
0
        private Vector2D PupilCornerDistance(Gaze gaze, HeadPose headPose)
        {
            var leftPupilCornerVector = gaze.PupilPosition.Left - gaze.InnerEyeCornerPosition.Left;

            var headAngel = headPose.Angle;
            var headPitch = Angle.FromRadians(headAngel.X);
            var headYaw   = Angle.FromRadians(headAngel.Y);
            var headRoll  = Angle.FromRadians(headAngel.Z);
            var realigned = CoordinateSystem.Rotation(headYaw, headPitch, headRoll);

            leftPupilCornerVector = leftPupilCornerVector.TransformBy(realigned);

            var xDistance = leftPupilCornerVector.X;
            var yDistance = leftPupilCornerVector.Y;

            return(new Vector2D(xDistance, yDistance));
        }
Example #17
0
 public Saccade(Gaze start, Gaze end)
 {
     vectorX  = end.gazeX - start.gazeX;
     vectorY  = end.gazeY - start.gazeY;
     length   = Math.Sqrt(vectorX * vectorX + vectorY * vectorY);
     duration = end.timestamp - start.timestamp - start.duration;
     if (duration <= 0)
     {
         duration = 0;
         Console.WriteLine(duration + " The saccade duration shouldn't be negative");
         velocity = 0;
     }
     else
     {
         velocity = length / duration;
     }
 }
        public void update(float posX, float posY, float timestamp)
        {
            Gaze g = new Gaze();

            g.gazeX     = posX;
            g.gazeY     = posY;
            g.timestamp = timestamp;
            gazes.Add(g);
            GazeData gd = new GazeData();

            gd.gazes  = gazes;
            gd.gazes  = GazeData.fixationBusher2008(gd.gazes);
            gd.lines  = GazeData.lineBreakDetectionSimple(ref gd.gazes);
            fixations = gd.gazes;
            nbWords   = (int)(gd.TotalLinesLength / space);
            //I had one word per line in the estimation because the fixations are found at the center of the words
            nbWords += gd.lines.Count;
        }
Example #19
0
 private void Awake()
 {
     gaze = GetComponent <Gaze>();
 }
Example #20
0
 private void CopyTo(Gaze g, int cloneFlags)
 {
     g.atom_   = atom_;
     g.toggle_ = toggle_;
 }
Example #21
0
 void Awake()
 {
     // Set this class to behave similar to singleton
     Instance = this;
     _cursor  = CreateCursor();
 }
Example #22
0
 private void Awake()
 {
     // Set this class to behave similar to singleton
     instance = this;
 }
Example #23
0
 private void Start()
 {
     gaze = GameMaster.instance.GetPlayerGaze();
     inv  = GameMaster.instance.GetInventory();
     gm   = GameMaster.instance;
 }
Example #24
0
        //creating a csv. name : lines_Benedick_3.csv, content: X;y;timestamp;duration;lineID

        //reading the csv and alanyse each different lineID. For each fixation line, computing the y median position,
        //taking the n neareast text line of the corresponding xml (the xml name correspond to the last letter of the csv file)
        //Save 1 file per fixation line
        //The file contain: n+1 lines (the first is the fixation line, and next ones are the nearest text lines with the potition of the words) : lineID; x1; x2; x3 …
        static void nearestXMLLines(string fixationLinefilename, string xmlFolder)
        {
            #region serialize the XMLs
            string[] xmlFiles  = Directory.GetFiles(xmlFolder, "*.xml");
            int      xmlNumber = int.Parse(fixationLinefilename[fixationLinefilename.Length - 5].ToString());
            //select the good xml file
            string xmlPath = "";
            foreach (var item in xmlFiles)
            {
                if (int.Parse(item[item.Length - 5].ToString()) == xmlNumber)
                {
                    xmlPath = item;
                    break;
                }
            }
            if (xmlPath == "")
            {
                Console.WriteLine("Error, the XML file corresponding to the csv cannot be found.");
                Console.ReadLine();
                return;
            }
            PcGts         xml;
            XmlSerializer xs = new XmlSerializer(typeof(PcGts));
            using (StreamReader rd = new StreamReader(xmlPath))
            {
                xml = xs.Deserialize(rd) as PcGts;
            }
            #endregion
            #region Analyse the fixations and the lines, create corresponding objects
            List <string> fixations = File.ReadAllLines(fixationLinefilename).ToList();
            fixations.RemoveAt(0); //remove the header
            List <GazeLine> lines      = new List <GazeLine>();
            int             idLine     = -1;
            GazeLine        curentLine = new GazeLine();
            for (int i = 0; i < fixations.Count; i++)
            {
                Gaze     g     = new Gaze();
                string[] split = fixations[i].Split(';');
                g.gazeX     = float.Parse(split[0]);
                g.gazeY     = float.Parse(split[1]);
                g.timestamp = float.Parse(split[2]);
                g.duration  = float.Parse(split[3]);
                g.idLine    = int.Parse(split[4]);
                if (i == 0)
                {
                    idLine            = g.idLine;
                    curentLine.idLine = g.idLine;
                }
                else if (idLine != g.idLine)
                {
                    //save the line
                    lines.Add(curentLine);
                    //start a new one
                    curentLine        = new GazeLine();
                    idLine            = g.idLine;
                    curentLine.idLine = g.idLine;
                }
                curentLine.gazes.Add(g);
            }
            //add the last group
            lines.Add(curentLine);
            #endregion
            //Foreach line take the 5 nearest text line (in y)
            foreach (var line in lines)
            {
                //get median y of line
                double y = line.MedianY;
                Dictionary <int, TextLine> nnLines = nearestLines(y, nbNeareastLines, xml);
                //save the fixation x pos and the nearest text lines
                string        nameFile     = fixationLinefilename.Replace(".csv", "_" + line.idLine + ".txt");
                List <string> linesToWrite = new List <string>();
                linesToWrite.Add("idLine; x1; x2;...");
                string lineFixation = line.idLine.ToString();
                foreach (var item in line.gazes)
                {
                    lineFixation += ";" + item.gazeX + ";" + item.gazeY;
                }
                linesToWrite.Add(lineFixation);
                foreach (var item in nnLines)
                {
                    string lineTxtToWrite = item.Key.ToString();
                    foreach (var word in item.Value.Words)
                    {
                        lineTxtToWrite += ";" + word.Center.X + ";" + word.Center.Y;
                    }
                    linesToWrite.Add(lineTxtToWrite);
                }
                File.WriteAllLines(nameFile, linesToWrite);
            }
        }
Example #25
0
 public Record(Gaze gaze, HeadPose headPose, Point2D display)
 {
     Gaze     = gaze;
     HeadPose = headPose;
     Display  = display;
 }
Example #26
0
    IEnumerator Schedule(Gaze chunk)
    {
        yield return new WaitForSeconds(chunk.Start);
        float duration = chunk.End;
        while (gazePriority > chunk.Priority && duration > 0f) {
            yield return new WaitForEndOfFrame();
            duration -= Time.deltaTime;
        }
        if (duration > 0) {
            gazePriority = chunk.Priority;
            DebugManager.Instance.OnChunkStart(chunk);
            //ignores ready and relax for now
            if (chunk.Target == null) {
                //we actually just want to glance away rather than look at anything specific
                switch (chunk.Influence) {
                    case Behaviour.Lexemes.Influence.EYES:
                        StartCoroutine(GlanceAway(duration));
                        break;
                    case Behaviour.Lexemes.Influence.HEAD:
                        StartCoroutine(GlanceAway(duration, affectHead: true));
                        break;
                    case Behaviour.Lexemes.Influence.WAIST:
                        StartCoroutine(GazeRandom(duration, returnToPreviousTarget: true));
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

            } else {
                //we have a specific target in mind
                switch (chunk.Influence) {
                    case Behaviour.Lexemes.Influence.EYES:
                        StartCoroutine(Glance(chunk.Target, duration));
                        break;
                    case Behaviour.Lexemes.Influence.HEAD:
                        StartCoroutine(Glance(chunk.Target, duration, affectHead: true));
                        break;
                    case Behaviour.Lexemes.Influence.WAIST:
                        StartCoroutine(Gaze(chunk.Target, duration, returnToPreviousTarget: true));
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }

            yield return new WaitForSeconds(duration);
            if (gazePriority == chunk.Priority) gazePriority = 0;
        } else {
            Debug.Log("Chunk cancelled. " + chunk);
        }
        yield return null;
    }