コード例 #1
0
 void Start()
 {
     command           = null;
     hearingProperties = GetComponent <HearingProperties>();
     audioSource       = hearingProperties.getAudioSource();
     Debug.Log("RHS>>> " + this.name + " is ready to receive Speech Commands.");
 }
コード例 #2
0
    private void insertHearPos(GameObject go, DateTime dt)
    {
        CartesianPos      cPos = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        HearingProperties auxHearingProperties = go.GetComponent <HearingProperties>();
        HearingAttribute  soundType            = HearingAttribute.unknownSound;
        float             volume = 0;
        string            desc   = "";

        if (auxHearingProperties != null)
        {
            soundType = auxHearingProperties.getSoundType();
            volume    = auxHearingProperties.getVolume();
            desc      = auxHearingProperties.getSoundDetail();
        }
        RobotHear rh = new RobotHear(
            dt,                     // the event occurs now
            cPos,                   // object  identifier
            soundType,              // I heard a beautiful music
            volume,                 // the volume is in the middle
            desc);                  // sound detail

        try                         // Try to access a resource.
        {
            rh.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.
        }
    }
コード例 #3
0
    void Start()
    {
        scm        = simulatorManager.GetComponent <SimulatorCommandsManager>();
        sm         = simulatorManager.GetComponent <SensesManager>();
        vision     = scm.robot.GetComponent <VisionManager>();
        smell      = scm.robot.GetComponent <SmellManager>();
        hearing    = scm.robot.GetComponent <HearingManager>();
        taste      = scm.robot.GetComponent <TasteManager>();
        touch      = scm.robot.GetComponent <TouchManager>();
        robotHProp = scm.robot.GetComponent <HearingProperties>();

        uid = scm.GetComponent <UniqueIdDistributor>();

        height           = robotCamera.pixelHeight;
        width            = robotCamera.pixelWidth;
        textVision       = visionComponent.GetComponent <Text>();
        textSmell        = smellComponent.GetComponent <Text>();
        textHearing      = hearingComponent.GetComponent <Text>();
        textTaste        = tasteComponent.GetComponent <Text>();
        textTouch        = touchComponent.GetComponent <Text>();
        textSpeech       = speechComponent.GetComponent <Text>();
        commandTextField = statusPanel.Find("CommandText").GetComponent <Text>();
        statusTextField  = statusPanel.Find("StatusText").GetComponent <Text>();
        textTaste.text   = "";
        textVision.text  = "";
        textSmell.text   = "";
        textHearing.text = "";
        textTouch.text   = "";
        textSpeech.text  = "";

        if (timePanel != null)
        {
            playButton  = timePanel.Find("PlayButton").GetComponent <UnityEngine.UI.Button>();
            pauseButton = timePanel.Find("PauseButton").GetComponent <UnityEngine.UI.Button>();
            stopButton  = timePanel.Find("StopButton").GetComponent <UnityEngine.UI.Button>();
            //stopButton.interactable = false;
            pauseSimulation();
        }
        Debug.Log("RHS>>> " + this.name + " is ready.");
    }
コード例 #4
0
    public string getStringHearInformation()
    {
        string str = "";

        foreach (GameObject obj in soundsInHearing)
        {
            str += SEPARATOR;
            str += "\nPosition: " + obj.transform.position;
            HearingProperties auxHearingProperties = obj.GetComponent <HearingProperties>();
            if (auxHearingProperties != null)
            {
                str += "\n" + auxHearingProperties.getHearingStatus();
            }
            else
            {
                str += "\nSound Type: " + HearingAttribute.unknownSound;
                str += "\nVolume: " + 0.0f;
            }
            str += "\n";
        }
        foreach (GameObject obj in knowObjInHearing)
        {
            str += SEPARATOR;
            str += "\nID: " + uIDD.getID(obj);
            HearingProperties auxHearingProperties = obj.GetComponent <HearingProperties>();
            if (auxHearingProperties != null)
            {
                str += "\n" + auxHearingProperties.getHearingStatus();
            }
            else
            {
                str += "\nSound Type: " + HearingAttribute.unknownSound;
                str += "\nVolume: " + 0.0f;
            }
            str += "\n";
        }
        return(str);
    }
コード例 #5
0
    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);
    }