Esempio n. 1
0
    void Awake()
    {
        m_hamsterdata = new HamsterData();

        LoadData(); //Get past data

        //Calculate the time it took from
        //when the game last ended to when it began
        //and see how many seconds have passed since then
        float OldHours   = m_hamsterdata.Hours;
        float OldMinutes = m_hamsterdata.Minutes;
        float OldSeconds = m_hamsterdata.Seconds;

        float SystemHour   = System.DateTime.Now.Hour;
        float SystemMinute = System.DateTime.Now.Minute;
        float SystemSecond = System.DateTime.Now.Second;

        //If the time passes midnight, the hour turns to 0.
        //This means that we have to make sure that the total
        //is more than OldHours.
        if (SystemHour < OldHours)
        {
            SystemHour += 24.0f;
        }

        float difhour = SystemHour - OldHours;
        float difmin  = SystemMinute - OldMinutes;
        float difsec  = SystemSecond - OldSeconds;

        //Make sure the time is positive
        if (difhour < 0.0f)
        {
            difhour = -difhour;
        }
        if (difmin < 0.0f)
        {
            difmin = -difmin;
        }
        if (difsec < 0.0f)
        {
            difsec = -difsec;
        }

        float hourinsecs   = ((difhour * 60) * 60);
        float minuteinsecs = (difmin * 60);

        totalTimeMissedInSecs = hourinsecs + minuteinsecs + difsec;

        //Set up Starting Emotions
        m_pleasure  = m_hamsterdata.Pleasure;
        m_dominance = m_hamsterdata.Dominance;
        m_arousal   = m_hamsterdata.Arousal;
        m_emotion   = m_hamsterdata.Emotion;
    }
Esempio n. 2
0
    void Check(string _action)
    {
        ErrorChecking();

        if (m_pleasure == 0.0f && m_arousal == 0.0f && m_dominance == 0.0f)
        {
            //Neutral
            m_emotion = CURRENT_EMOTION.Neutral;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if ((m_pleasure >= 0.0f && m_pleasure <= 0.03f) &&
                 (m_arousal >= 0.0f && m_arousal <= 0.05f) &&
                 (m_dominance >= 0.0f && m_arousal <= 0.05f))
        {
            //passive Happy
            m_emotion = CURRENT_EMOTION.PassiveHappy;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if ((m_pleasure <= 0.0f && m_pleasure >= -0.03f) &&
                 (m_arousal <= 0.0f && m_arousal >= -0.05f) &&
                 (m_dominance <= 0.0f && m_arousal >= -0.05f))
        {
            //Passive Sad
            m_emotion = CURRENT_EMOTION.PassiveSad;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }


        // HAPPY EMOTIONS
        else if (m_pleasure > 0.0f && m_arousal > 0.0f && m_dominance > 0.0f)
        {
            //Exuberant
            m_emotion = CURRENT_EMOTION.Exuberant;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure > 0.0f && m_arousal > 0.0f && m_dominance <= 0.0f)
        {
            //Dependant
            m_emotion = CURRENT_EMOTION.Dependant;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure > 0.0f && m_arousal <= 0.0f && m_dominance > 0.0f)
        {
            //Relaxed
            m_emotion = CURRENT_EMOTION.Relaxed;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure > 0.0f && m_arousal <= 0.0f && m_dominance <= 0.0f)
        {
            //Docile
            m_emotion = CURRENT_EMOTION.Docile;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }


        //SAD EMOTIONS
        else if (m_pleasure < -0.0f && m_arousal < -0.0f && m_dominance < -0.0f)
        {
            //Bored
            m_emotion = CURRENT_EMOTION.Bored;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure < -0.0f && m_arousal < -0.0f && m_dominance >= 0.0f)
        {
            //Disdainful
            m_emotion = CURRENT_EMOTION.Disdainful;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure < -0.0f && m_arousal >= 0.0f && m_dominance < -0.0f)
        {
            //Anxious
            m_emotion = CURRENT_EMOTION.Anxious;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }
        else if (m_pleasure < -0.0f && m_arousal >= 0.0f && m_dominance >= 0.0f)
        {
            //Hostile
            m_emotion = CURRENT_EMOTION.Hostile;
            Debug.Log(m_emotion.ToString());
            //m_animator.SetCurrentEmotion(0);
            m_Text.SetDisplay(m_emotion.ToString() +
                              " P: " + m_pleasure.ToString() +
                              " A: " + m_arousal.ToString() +
                              " D: " + m_dominance.ToString());
        }

        float hour = System.DateTime.Now.Hour;
        float min  = System.DateTime.Now.Minute;
        float sec  = System.DateTime.Now.Second;

        txtTime.Add(hour + ":" + min + ":" + sec);

        //txtTime.Add(System.DateTime.Now.TimeOfDay.ToString());
        txtP.Add(m_pleasure);
        txtA.Add(m_arousal);
        txtD.Add(m_dominance);
        txtEmotion.Add(m_emotion);
        txtAction.Add(_action);
    }