void alterLandscape(EmotionJson emotionJson) { Emo emotion = emotionJson.getMax(); switch (emotion) { case Emo.Angry: setAngryLandscape(); break; case Emo.Fear: setFearLandscape(); break; case Emo.Happy: setHappyLandscape(); break; case Emo.Neutral: setNeutralLandscape(); break; case Emo.Sad: setSadLandscape(); break; case Emo.Surprise: setSurpriseLandscape(); break; default: break; } }
void getFakeEmotion() { EmotionJson json = new EmotionJson(); json.angry = 1F; json.fear = 0F; json.happy = 0F; json.neutral = 0F; json.sad = 2F; json.surprise = 3F; alterLandscape(json); }
IEnumerator getEmotion() { WWW www = new WWW("http://localhost:5000/api/emotions"); yield return(www); Debug.Log(www.isDone); Debug.Log("Done getting emotion."); if (www.isDone) { string jsonString = www.text; if (!jsonString.StartsWith("null")) { EmotionJson json = JsonUtility.FromJson <EmotionJson> (jsonString); } } }