void ReferenceObject(object sender, EventArgs e) { Debug.Log(string.Format("Referring to {0}", focusObj.name)); //List<string> descriptors = new List<string>(); descriptorString = string.Empty; if (world.interactionPrefs.gesturalReference) { distanceDistinction = false; GameObject hand = InteractionHelper.GetCloserHand(agent, focusObj); world.PointAt(focusObj.transform.position, hand); if (world.interactionPrefs.linguisticReference) { // G + L // variables: bool proximal/distal distinction (this/that) // int 0-3 relational descriptors distanceDistinction = Convert.ToBoolean( RandomHelper.RandomInt(0, 1, (int)(RandomHelper.RangeFlags.MinInclusive) | (int)(RandomHelper.RangeFlags.MaxInclusive))); relativeDistance = Convert.ToBoolean( RandomHelper.RandomInt(0, 1, (int)(RandomHelper.RangeFlags.MinInclusive) | (int)(RandomHelper.RangeFlags.MaxInclusive))); int relationalDescriptors = RandomHelper.RandomInt(0, 4); Debug.Log(string.Format( "Use distance distinction: {0}, relative distance: {1}, {2} relational descriptors", distanceDistinction, relativeDistance, relationalDescriptors)); Voxeme objVox = focusObj.GetComponent <Voxeme>(); string demonstrative = "That"; if (distanceDistinction) { if (relativeDistance) { // !relative distance -> absolute distance (near region = this, far region = that) // is focusObj closer to the agent than the other block of the same color? string color = string.Empty; color = objVox.voxml.Attributes.Attrs[0].Value; // just grab the first one for now List <GameObject> otherObjs = world.availableObjs.Where(b => b.GetComponent <Voxeme>().voxml.Attributes.Attrs[0].Value == color && b != focusObj).ToList(); if (otherObjs.Count > 0) { if (Vector3.Distance(agent.transform.position, focusObj.transform.position) < Vector3.Distance(agent.transform.position, otherObjs[0].transform.position)) { demonstrative = "This"; } } else { // default to absolute distance if (world.frontRegion.Contains(new Vector3( focusObj.transform.position.x, world.frontRegion.center.y, focusObj.transform.position.z))) { demonstrative = "This"; } } } else { if (world.frontRegion.Contains(new Vector3( focusObj.transform.position.x, world.frontRegion.center.y, focusObj.transform.position.z))) { demonstrative = "This"; } } } descriptorString = FindFocusObjRelations(relationalDescriptors); if (objVox != null) { string color = string.Empty; color = objVox.voxml.Attributes.Attrs[0].Value; // just grab the first one for now fullDesc = string.Format("{0} {1} {2}{3}.", demonstrative, color, objVox.opVox.Lex.Pred, descriptorString); world.RespondAndUpdate(fullDesc); } } } else if (world.interactionPrefs.linguisticReference) { // variables: int 1-3 relational descriptors distanceDistinction = false; int relationalDescriptors = RandomHelper.RandomInt(1, 4); descriptorString = FindFocusObjRelations(relationalDescriptors); Voxeme objVox = focusObj.GetComponent <Voxeme>(); if (objVox != null) { string color = string.Empty; color = objVox.voxml.Attributes.Attrs[0].Value; // just grab the first one for now fullDesc = string.Format("The {0} {1}{2}.", color, objVox.opVox.Lex.Pred, descriptorString); world.RespondAndUpdate(fullDesc); } } }