public string getStringVisionInformation() { string str = ""; foreach (GameObject obj in objectsInFildOfVision) { if (!isHiddenObject(obj)) { str += SEPARATOR; str += "\nID: " + uIDD.getID(obj); str += "\nName: " + obj.name; if (obj.GetComponent <VisionManager>() != null && obj.GetComponent <VisionManager>() == vision) { str += "\nType: " + "SelfRobot"; } else { str += "\nType: " + obj.tag; } str += "\nPosition: " + obj.transform.position; VisionProperties auxVisionProperties = obj.GetComponent <VisionProperties>(); if (auxVisionProperties != null) { str += "\n" + auxVisionProperties.getVisionStatus(); } else { str += "\nRGB: 0, 0, 0"; str += "\nType: " + OntSenseCSharpAPI.Material.unknownMaterial; } Status auxStatus = obj.GetComponent <Status>(); if (auxStatus != null) { string aux = auxStatus.getStringStatus(); str += "\nStatus: " + aux; } else { //str += "\nSatus: " + ObjectStatus.None; } EmotionStatus auxEmotionStatus = obj.GetComponent <EmotionStatus>(); if (auxEmotionStatus != null) { str += "\nEmotion: " + auxEmotionStatus.getEmotion().ToString(); } str += "\n"; } } return(str); }
private void insertVision(GameObject go, DateTime dt) { CartesianPos cPos = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z); VisionProperties auxVision = go.GetComponent <VisionProperties>(); Status auxStatus = go.GetComponent <Status>(); RGBValue rgb; OntSenseCSharpAPI.Material material = OntSenseCSharpAPI.Material.unknownMaterial; PhysicalState state = PhysicalState.noneState; string tag = go.tag; string uri = ""; if (auxStatus != null) { state = auxStatus.getStatus(); } if (auxVision != null) { rgb = auxVision.getRGB(); material = auxVision.getMaterial(); if (auxVision == vision) { tag = "SelfRobot"; } uri = auxVision.getURI(); } else { rgb = new RGBValue(0, 0, 0); } EmotionalState emotion = EmotionalState.neutralEmotion; EmotionStatus auxEmotion = go.GetComponent <EmotionStatus>(); if (auxEmotion != null) { emotion = auxEmotion.getEmotion(); } RobotVision rv; switch (go.tag) { case Constants.TAG_ROBOT: Robot auxRobot = new Robot(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri); rv = new RobotVision(dt, auxRobot); break; case Constants.TAG_HUMAN: Human auxHuman = new Human(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri, emotion); rv = new RobotVision(dt, auxHuman); break; default: Thing auxThing = new Thing(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri); rv = new RobotVision(dt, auxThing); break; } try // Try to access a resource. { rv.insert(); // using dotNetRDF library inserts the information in the triple store } catch (Exception e) { Debug.Log("System>>> " + e.Message); // change for your: LogError(e); // Call a custom error logging procedure. } }
private string buildPropertiesString(GameObject gO) { string sensesProperty = ""; string especificProperty = ""; string emotionProperty = ""; SmellProperties auxSmellProperties = gO.GetComponent <SmellProperties>(); if (auxSmellProperties != null) { sensesProperty += auxSmellProperties.getSmellStatus(); } TasteProperties auxTasteProperties = gO.GetComponent <TasteProperties>(); if (auxTasteProperties != null) { sensesProperty += "\n" + auxTasteProperties.getTasteStatus(); } HearingProperties auxHearingProperties = gO.GetComponent <HearingProperties>(); if (auxHearingProperties != null) { sensesProperty += "\n" + auxHearingProperties.getHearingStatus(); } TouchProperties auxTouchProperties = gO.GetComponent <TouchProperties>(); if (auxTouchProperties != null) { sensesProperty += "\n" + auxTouchProperties.getTouchStatus(); } VisionProperties auxVisionProperties = gO.GetComponent <VisionProperties>(); if (auxVisionProperties != null) { sensesProperty += "\n" + auxVisionProperties.getVisionStatus(); } EmotionStatus auxEmotionStatus = gO.GetComponent <EmotionStatus>(); if (auxEmotionStatus != null) { emotionProperty = auxEmotionStatus.getEmotion().ToString(); } Status auxStatus = gO.GetComponent <Status>(); if (auxStatus != null) { especificProperty = auxStatus.getStringStatus(); } string auxText = "ID: " + gO.GetInstanceID() + "\n" + gO.tag + ": " + gO.name + "\nPosition: " + gO.transform.position; if (!sensesProperty.Equals("None")) { auxText += "\n" + sensesProperty; } if (emotionProperty.Equals("")) { emotionProperty = "None"; } if (especificProperty.Equals("")) { especificProperty = "None"; } auxText += "\nStatus: " + especificProperty; auxText += "\nEmotion: " + emotionProperty; return(auxText); }