Beispiel #1
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);
        }
Beispiel #2
0
 private void OnHappy()
 {
     if (Happy != null)
     {
         Happy.Invoke();
     }
 }
Beispiel #3
0
        public void TestHappy()
        {
            //arrange
            int[] expected = Happy.TestNumbers;
            Happy sequence = new Happy(expected.Last());

            //act assert
            TestSequence(sequence, expected);
        }
        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);
    }
Beispiel #6
0
 public MainWindowPanel()
 {
     Timer  = new DateTimer();
     Player = new Player(Timer)
     {
         State = 0,
         Money = 9000,
         Happy = 100,
     };
     Computer  = new Computer(Player);
     Soft      = new Soft(Player, Computer);
     Work      = new Work(Timer, Player, Player);
     Work.Work = 0;
     Happy     = new Happy(Player, Soft);
     Torrent   = new Torrent(Timer, Player, Soft);
     Hack      = new Hack(Player);
     Forum     = new Forum(Player, (Hack)Hack);
     Events    = new Events(Timer, Player, Soft, Soft, Computer);
     Task.Run(() => { GoHelpString(); });
 }
Beispiel #7
0
    // Update is called once per frame
    void FixedUpdate()
    {
        for (int x = 0; x < GameManager.listOfMice.Count; x++)
        {
            //declare a var of type Vector3, called "directionToMouse",
            //set to a vector that goes from [current position] to [mouse's current position]
            Vector3 directionToMouse = (mouse.position - transform.position);

            //if the angle between [current forward direction] vs. [directionToMouse] is less than 90 degrees, then...
            if (Vector3.Angle(transform.forward, directionToMouse) < 180f)
            {
                // declare a var of type Ray, called "catRay" that starts from [current position] and goes along [directionToMouse]
                Ray catRay = new Ray(transform.position, directionToMouse);

                //declare a var of type RaycastHit, called "catRayHitInfo"
                RaycastHit catRayHitInfo = new RaycastHit();

                //if raycast with catRay and catRayHitInfo for 100 units is TRUE...
                if (Physics.Raycast(catRay, out catRayHitInfo, 100f))
                {
                    //  if catRayHitInfo.collider.tag is exactly equal to the word "Mouse"... (Cat sees the mouse!)
                    if (catRayHitInfo.collider.tag == "Mouse")
                    {
                        //if catRayHitInfo.distance is less than or equal to 5...
                        Eat.Play();
                        if (catRayHitInfo.distance <= 0.5)
                        {
                            // then destroy the mouse gameObject (we caught the mouse!)
                            Happy.Play();
                            Destroy(mouse.gameObject);
                        }
                        else
                        {
                            //add force on rigidbody, along [directionToMouse.normalized * 1000f] (chase it!)
                            rb.AddForce(directionToMouse.normalized * 1000f);
                        }
                    }
                }
            }
        }
    }
Beispiel #8
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);
    }
Beispiel #10
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);
    }
Beispiel #11
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();
        }
Beispiel #12
0
 public HappyWindowPanel(Happy happy)
 {
     Happy = happy;
 }
Beispiel #13
0
        public void TestHappyNegative()
        {
            var actual = new Happy().FaceMask();

            Assert.AreNotEqual(expected: ":-)", actual: actual);
        }
Beispiel #14
0
        public void TestHappyPositive()
        {
            var actual = new Happy().FaceMask();

            Assert.AreEqual(expected: ":-))", actual: actual);
        }