private void OnAngry()
 {
     if (Angry != null)
     {
         Angry.Invoke();
     }
 }
Exemple #2
0
        private static string SetMood(int totalHappiness)
        {
            string mood = string.Empty;

            if (totalHappiness < -5)
            {
                Angry angry = new Angry();
                mood = angry.SetMood(totalHappiness);
            }
            else if (totalHappiness >= -5 && totalHappiness <= 0)
            {
                Sad sad = new Sad();
                mood = sad.SetMood(totalHappiness);
            }
            else if (totalHappiness >= 1 && totalHappiness <= 15)
            {
                Happy happy = new Happy();
                mood = happy.SetMood(totalHappiness);
            }
            else if (totalHappiness > 15)
            {
                JavaScript js = new JavaScript();
                mood = js.SetMood(totalHappiness);
            }

            return(mood);
        }
        public override string ToString()
        {
            string result = Timestamp.ToString();

            result += ";" + Neutral.ToString();
            result += ";" + Happy.ToString();
            result += ";" + Sad.ToString();
            result += ";" + Angry.ToString();
            result += ";" + Surprised.ToString();
            result += ";" + Scared.ToString();
            result += ";" + Disgusted.ToString();
            result += ";" + Contempt.ToString();
            result += ";" + Valence.ToString();
            result += ";" + Arousal.ToString();

            return(result);
        }
    private void Awake()
    {
        //For scared condition
        orangeDino = GameObject.FindObjectOfType <OrangeDinoBoo>();

        //For angry condition
        greenDino = GameObject.FindObjectOfType <CubeDinoCollect>();

        //For sad condition
        calCounter = GameObject.FindObjectOfType <CubeCaloryCounter>();

        //friend bot not written yet


        _stateMachine = new StateMachine();


        //here the Emotion States are declared and instantiated:
        var scared = new Scared(this /*,  animator*/);
        var happy  = new Happy(this);
        var sad    = new Sad(this);
        var angry  = new Angry(this);

        //var depressed = new Depressed(this);

        //here ALL the transitions are added(declared) to _transition
        At(happy, sad, calCounter.calories > hungerCal);
        At(sad, happy, calCounter.calories < hungerCal);



        At(angry, happy, orangeDino.booNear1);
        At(happy, angry, angry.timeStuck > 1f);

        _stateMachine.AddAnyTransition(scared, orangeDino.booNear1);
        At(happy, scared, scared.timeStuck > 3f);



        //Set the starting ( happy) state
        _stateMachine.SetState(happy);


        void At(IState to, IState from, bool condition) => _stateMachine.AddTransition(to, from, condition);
    }
Exemple #5
0
    /// <summary>
    /// This generates the conditions of the new cow
    /// </summary>
    private void GenerateConditions()
    {
        //:TODO: add individual variation into fuzzy distributions

        // Wellness - Physical conditions
        m_Pain    = new Pain(this);
        m_Sick    = new Sick(this);
        m_Wounded = new Wounded(this);
        m_Damage  = new Damage(this);
        m_Tired   = new Tired(this);
        m_Hungry  = new Hungry(this);
        m_Thirsty = new Thirsty(this);
        m_Dead    = new Dead(this);

        // Contentment - Mental conditions
        m_Anger  = new Angry(this);
        m_Sleepy = new Sleepy(this);
        m_Scared = new Scared(this);
        m_Bored  = new Bored(this);
        m_Lonely = new Lonely(this);
        m_Happy  = new Happy(this);
        m_Eager  = new Eager(this);
    }
    public static Mood GetMood(int happinessPoints)
    {
        Mood mood = null;

        if (happinessPoints < -5)
        {
            mood = new Angry();
        }
        else if (happinessPoints <= 0)
        {
            mood = new Sad();
        }
        else if (happinessPoints <= 15)
        {
            mood = new Happy();
        }
        else
        {
            mood = new JavaScript();
        }

        return(mood);
    }
Exemple #7
0
    public static Mood CreateMood(int happiness)
    {
        Mood newMood = null;

        if (happiness < -5)
        {
            newMood = new Angry();
        }
        else if (happiness <= 0)
        {
            newMood = new Sad();
        }
        else if (happiness < 15)
        {
            newMood = new Happy();
        }
        else
        {
            newMood = new JavaScript();
        }

        return(newMood);
    }
Exemple #8
0
        static void Main(string[] args)
        {
            try
            {
                int      totalpoints = 0;
                string   a           = Console.ReadLine();
                string[] s           = a.Split(' ');
                if (a.Length > 1000)
                {
                    throw new Exception("The characters in the input string will be no more than: 1000");
                }
                if (s.Length < 1 || s.Length > 100)
                {
                    throw new Exception("The food count would be in the range [1…100].");
                }
                string caseSwitch;
                foreach (var p in s)
                {
                    caseSwitch = p;
                    switch (caseSwitch)
                    {
                    case "Apple":
                        Apple apple = new Apple(p);
                        totalpoints += apple.Point;
                        break;

                    case "Cram":
                        Cram cram = new Cram(p);
                        totalpoints += cram.Point;
                        break;

                    case "HoneyCake":
                        HoneyCake honeyCake = new HoneyCake(p);
                        totalpoints += honeyCake.Point;
                        break;

                    case "Lembas":
                        Lembas lembas = new Lembas(p);
                        totalpoints += lembas.Point;
                        break;

                    case "Melon":
                        Melon melon = new Melon(p);
                        totalpoints += melon.Point;
                        break;

                    case "Mushrooms":
                        Mushrooms mushrooms = new Mushrooms(p);
                        totalpoints += mushrooms.Point;
                        break;

                    default:
                        EverithingElse everithingElse = new EverithingElse(p);
                        totalpoints += everithingElse.Point;
                        break;
                    }
                }
                if (totalpoints < -5)
                {
                    Angry angry = new Angry();
                    Console.WriteLine(totalpoints);
                    angry.Output();
                }
                else if (totalpoints >= 1 && totalpoints <= 15)
                {
                    Happy happy = new Happy();
                    Console.WriteLine(totalpoints);
                    happy.Output();
                }
                else if (totalpoints >= -5 && totalpoints <= 0)
                {
                    Sad sad = new Sad();
                    Console.WriteLine(totalpoints);
                    sad.Output();
                }
                else if (totalpoints > 15)
                {
                    JavaScript javaScript = new JavaScript();
                    Console.WriteLine(totalpoints);
                    javaScript.Output();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }


            Console.ReadKey();
        }