private static string GetMessageType(EmotionStatus emotion)
        {
            var type = string.Empty;

            switch (emotion)
            {
            case EmotionStatus.Absence:
            case EmotionStatus.Sleeping:
                type = "error";
                break;

            case EmotionStatus.Wandering:
            case EmotionStatus.Streching:
                type = "warning";
                break;

            case EmotionStatus.HandUp:
            case EmotionStatus.Nodding:
                type = "success";
                break;

            case EmotionStatus.Thinking:
            case EmotionStatus.Shaking:
            case EmotionStatus.Freezed:
            default:
                type = "info";
                break;
            }

            return(type);
        }
示例#2
0
    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 static string GenerateMessage(string client, EmotionStatus emotion)
        {
            var name = "王洋洋同学";

            var template = string.Empty;

            switch (emotion)
            {
            case EmotionStatus.Absence:
                template = RandomChoice(new string[] { "{0}已经离开", "{0}已离席", "{0}似乎不见" });
                break;

            case EmotionStatus.Sleeping:
                template = RandomChoice(new string[] { "{0}似乎睡着了的样子", "{0}正在酣睡中ZZzzzzZZZzzz..." });
                break;

            case EmotionStatus.Wandering:
                template = RandomChoice(new string[] { "{0}已经开始神游 yooooooo~~~" });
                break;

            case EmotionStatus.Streching:
                template = RandomChoice(new string[] { "{0}伸了个懒腰并打了个哈气", "{0}可能要准备睡了", "{0}觉得困困困了~~~唉~~~" });
                break;

            case EmotionStatus.HandUp:
                template = RandomChoice(new string[] { "{0}举起了小手👋", "{0}举起了小手🙋‍", "{0}举手要求回答问题啦!" });
                break;

            case EmotionStatus.Nodding:
                template = RandomChoice(new string[] { "{0}听的很投入", "{0}听懂了耶✌️" });
                break;

            case EmotionStatus.Thinking:
                template = RandomChoice(new string[] { "{0}正在认真思考", "{0}陷入了思索~" });
                break;

            case EmotionStatus.Shaking:
                template = RandomChoice(new string[] { "{0}似乎没有听懂", "{0}可能需要您阐述的再详细一些" });
                break;

            case EmotionStatus.Freezed:
            case EmotionStatus.None:
            default:
                template = "{0}正在听讲~";
                break;
            }

            return(string.Format(template, name));
        }
        private static int ComputeFocusIndex(EmotionStatus emotion)
        {
            int delta = RandomGenerator.Next(1, 10);

            var index = 0;

            switch (emotion)
            {
            case EmotionStatus.Sleeping:
                index = 10;
                break;

            case EmotionStatus.Streching:
                index = 20 + delta >> 1;
                break;

            case EmotionStatus.Wandering:
                index = 30 + delta;
                break;

            case EmotionStatus.Thinking:
                index = 70 + delta;
                break;

            case EmotionStatus.HandUp:
                index = 80 + delta;
                break;

            case EmotionStatus.Shaking:
                index = 85 + delta;
                break;

            case EmotionStatus.Nodding:
                index = 90 + delta;
                break;

            case EmotionStatus.Freezed:
            case EmotionStatus.None:
                index = 50;
                break;
            }

            return(index);
        }
示例#5
0
 // Use this for initialization
 void Start()
 {
     if (avatar != null)
     {
         aM               = avatar.GetComponent <AvatarManager>();
         speech           = avatar.GetComponent <AgentSpeech>();
         dropdownSelected = false;
         listObjects      = new List <GameObject>();
         listSwitchs      = new List <GameObject>();
         setItensInActionDropdown(aM.getAvailableActions());
         setItensInEmotionsDropdown();
         emotionStatus = avatar.GetComponent <EmotionStatus>();
         if (emotionStatus != null)
         {
             dropdownEmotions.value = (int)emotionStatus.getEmotion();
         }
         else
         {
             Debug.Log("RHS>>> Avatar " + avatar.name + " doesn't have Emotions");
         }
     }
 }
示例#6
0
    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.
        }
    }
示例#7
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);
    }