Пример #1
0
		/// <summary>
		/// Sets the user's mood to the specified mood value.
		/// </summary>
		/// <param name="mood">A value from the Mood enumeration to set the user's
		/// mood to.</param>
		/// <param name="description">A natural-language description of, or reason
		/// for, the mood.</param>
		public void SetMood(Mood mood, string description = null) {
			var xml = Xml.Element("mood", "http://jabber.org/protocol/mood")
				.Child(Xml.Element(MoodToTagName(mood)));
			if (description != null)
				xml.Child(Xml.Element("text").Text(description));
			pep.Publish("http://jabber.org/protocol/mood", null, xml);
		}
Пример #2
0
 public Animal(String petName, AnimalType type, Random rand)
 {
     this.petName = petName;
     this.type = type;
     this.vitality = rand.Next(10) + 1;
     this.mood = Mood.Calm;
 }
Пример #3
0
    void Update()
    {
        if(myIsEnabled)
        {
            myDisgruntlednessTimer -= Time.deltaTime;
            if(myDisgruntlednessTimer <= 0.0f)
            {
                myDisgruntlednessTimer += myHumourTimer;

                switch (myMood)
                {
                case(Mood.Yay):
                {
                    myMood = Mood.Hmm;
                    break;
                }
                case(Mood.Hmm):
                {
                    myMood = Mood.No;
                    break;
                }
                }
            }
        }
    }
Пример #4
0
		public GameState(Mood _mood) {
			Stats = new Stat[4];
			Stats[0] = new Stat();
			Stats[0].Name = "Food";
			Stats[0].Value = 100;
			Stats[0].IsNeeded = false;
			Stats[0].IsCritical = false;
			Stats[1] = new Stat();
			Stats[1].Name = "Drink";
			Stats[1].Value = 100;
			Stats[1].IsNeeded = false;
			Stats[1].IsCritical = false;
			Stats[2] = new Stat();
			Stats[2].Name = "Hygiene";
			Stats[2].Value = 100;
			Stats[2].IsNeeded = false;
			Stats[2].IsCritical = false;
			Stats[3] = new Stat();
			Stats[3].Name = "Activities";
			Stats[3].Value = 100;
			Stats[3].IsNeeded = false;
			Stats[3].IsCritical = false;

			Score = 0;
			Life = 100;
			mood = _mood;

		}
 /// <summary>
 /// Initializes a new instance of the MoodChangedEventArgs class.
 /// </summary>
 /// <param name="jid">The JID of the XMPP entity that published the
 /// mood information.</param>
 /// <param name="mood">One of the values from the Mood enumeration.</param>
 /// <param name="description">A natural-language description of, or
 /// reason for, the mood.</param>
 /// <exception cref="ArgumentNullException">The jid parameter is
 /// null.</exception>
 public MoodChangedEventArgs(Jid jid, Mood mood, string description = null)
 {
     jid.ThrowIfNull("jid");
     Jid = jid;
     Mood = mood;
     Description = description;
 }
Пример #6
0
        public ClassDelegates(Mood moodType, string x)
        {
            name = x;

            if (moodType == Mood.HAPPY)
                chosenGreet = new MyOperation(HappyGreet); // or simply, chosenGreet = HappyGreet;
            else
                chosenGreet = AngryGreet;
        }
Пример #7
0
        public AnonymousMethods(Mood moodType, string x)
        {
            name = x;

            if (moodType == Mood.HAPPY)
                chosenGreet = (string t) => { HappyGreet(t); };
            else
                chosenGreet = (t) => { Console.Write("OI! {0}. Do one!", t); };
        }
Пример #8
0
 internal VerbForm(Stem stem, Conjugation conjugation, Person person, Number number, Mood mood, Voice voice, Tense tense, string suffix)
     : base(stem, suffix)
 {
     Conjugation = conjugation;
     Person = person;
     Number = number;
     Mood = mood;
     Voice = voice;
     Tense = tense;
 }
Пример #9
0
 public void SetHappy()
 {
     currentMood = Mood.happy;
     mouthHappy.enabled = true;
     stalkHappy.enabled = true;
     mouthAnnoyed.enabled = false;
     stalkAnnoyed.enabled = false;
     mouthAngry.enabled = false;
     stalkAngry.enabled = false;
 }
Пример #10
0
 public void DualEnums()
 {
     Conn.RegisterEnum<Mood>("mood");
     Conn.RegisterEnum<TestEnum>("test_enum");
     var cmd = new NpgsqlCommand("SELECT @p1", Conn);
     var expected = new Mood[] { Mood.Ok, Mood.Sad };
     var p = new NpgsqlParameter("p1", NpgsqlDbType.Enum | NpgsqlDbType.Array) { EnumType = typeof(Mood), Value = expected };
     cmd.Parameters.Add(p);
     var result = cmd.ExecuteScalar();
     Assert.AreEqual(expected, result);
 }
Пример #11
0
        public void PublishMood(string mood, string reason)
        {
            XmlDocument doc = m_Account.Client.Document;

            PubSubItem itemElement = new PubSubItem(doc);
            itemElement.SetAttribute("id", "current");
            doc.AppendChild(itemElement);

            Mood moodElement = new Mood(doc, mood);
            moodElement.Text = reason;
            itemElement.AppendChild(moodElement);

            m_Account.GetFeature<PersonalEventing>().Publish(Namespace.Mood, itemElement);
        }
Пример #12
0
 public void DualEnums()
 {
     ExecuteNonQuery("CREATE TYPE pg_temp.mood AS ENUM ('Sad', 'Ok', 'Happy')");
     ExecuteNonQuery("CREATE TYPE pg_temp.test_enum AS ENUM ('label1', 'label2', 'label3')");
     Conn.ReloadTypes();
     Conn.RegisterEnum<Mood>("mood");
     Conn.RegisterEnum<TestEnum>("test_enum");
     var cmd = new NpgsqlCommand("SELECT @p1", Conn);
     var expected = new Mood[] { Mood.Ok, Mood.Sad };
     var p = new NpgsqlParameter("p1", NpgsqlDbType.Enum | NpgsqlDbType.Array) { EnumType = typeof(Mood), Value = expected };
     cmd.Parameters.Add(p);
     var result = cmd.ExecuteScalar();
     Assert.AreEqual(expected, result);
 }
Пример #13
0
    void Update()
    {
        if (Input.GetKeyDown (KeyCode.Alpha1)) {
            mood = Mood.Happy;
        } else if (Input.GetKeyDown (KeyCode.Alpha2)) {
            mood = Mood.Sad;
        } else if (Input.GetKeyDown (KeyCode.Alpha3)) {
            mood = Mood.Angry;
        } else if (Input.GetKeyDown (KeyCode.Alpha0)) {
            mood = Mood.Default;
        }

        animator.SetInteger ("mood", (int)mood);
    }
Пример #14
0
    public MoodModel(Personality agentPersonality)
    {
        //Calculation of default mood based on personality
        float DefaultPleasure = 0.21f * agentPersonality.Extraversion + 0.59f * agentPersonality.Agreeableness + 0.19f * agentPersonality.Neuroticism;
        float DefaultArousal = 0.15f * agentPersonality.Openness + 0.30f * agentPersonality.Agreeableness - 0.57f * agentPersonality.Neuroticism;
        float DefaultDominance = 0.25f * agentPersonality.Openness + 0.17f * agentPersonality.Conscientiousness + 0.60f * agentPersonality.Extraversion - 0.32f * agentPersonality.Agreeableness;

        //DefaultMood = new Mood (DefaultPleasure, DefaultArousal, DefaultDominance);

        //CurrentMood = new Mood (DefaultPleasure, DefaultArousal, DefaultDominance);

        //TODO REMOVE THIS CODE - TESTING PURPOSES
        DefaultMood = new Mood (0.0f, 0.0f, 0.0f);
        CurrentMood = new Mood (0.0f, 0.0f, 0.0f);
    }
Пример #15
0
 public static IConjugation Get(Mood mood, Voice voice, Tense tense)
 {
     if (!CONJUGATIONS.ContainsKey(mood))
       {
     throw new NotSupportedException(string.Format("unrecognised mood of sum : {0}", mood));
       }
       if (!CONJUGATIONS[mood].ContainsKey(voice))
       {
     throw new NotSupportedException(string.Format("unrecognised voice of sum : {0}", voice));
       }
       if (!CONJUGATIONS[mood][voice].ContainsKey(tense))
       {
     throw new NotSupportedException(string.Format("unrecognised tense of sum : {0}", tense));
       }
       return CONJUGATIONS[mood][voice][tense];
 }
Пример #16
0
 public override int GetMoodSequence(Mood mood)
 {
     switch(mood){
     case Mood.Normal:
         return 0;
     case Mood.Proud:
         return 2;
     case Mood.EyesClosed:
         return 3;
     case Mood.Happy:
         return 2;
     case Mood.Angry:
         return 1;
     default:
         return 0;
     }
 }
Пример #17
0
        private WordForm GetFirstConjugationForm(Person person, Number number, Mood mood, Voice voice, Tense tense)
        {
            var suffix = string.Empty;
            if (person == Person.First && number == Number.Singluar && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "m";
            if (person == Person.Second && number == Number.Singluar && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "s";
            if (person == Person.Third && number == Number.Singluar && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "t";
            if (person == Person.First && number == Number.Plural && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "mus";
            if (person == Person.Second && number == Number.Plural && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "tis";
            if (person == Person.Third && number == Number.Plural && mood == Mood.Indicative && voice == Voice.Active)
                suffix = "nt";

            return new VerbForm(this, Conjugation, person, number, mood, voice, tense, suffix);
        }
Пример #18
0
    public void SetMood(Mood targetMood, bool refresh)
    {
        Sprite newSprite = neutralSprite;
        Sprite newText = text;
        switch(targetMood)
        {
            case Mood.Angry:
                newSprite = angrySprite;
                newText = angryText;
                if (refresh) angryTime = angryDuration;
                break;
            case Mood.Happy:
                newSprite = happySprite;
                if (refresh) happyTime = happyDuration;
                break;
        }

        lokiRenderer.sprite = newSprite;
        textRenderer.sprite = newText;
    }
Пример #19
0
        public IEnumerator AsyncRangedFire(PlayerInventory inv, float _weaponChargeStartTime, InventoryItemView inventoryItemView, InventoryItemView inventoryItemView2, bool noconsume)
        {
            TheForest.Items.Item itemCache = inventoryItemView.ItemCache;
            bool       flag        = itemCache._maxAmount < 0;
            int        repeats     = ModdedPlayer.RangedRepetitions();
            Vector3    forceUp     = inventoryItemView2._held.transform.up;
            Vector3    right       = inventoryItemView2._held.transform.right;
            Vector3    up          = inventoryItemView2._held.transform.up;
            Vector3    originalPos = inventoryItemView2._held.transform.position;
            FakeParent component   = inventoryItemView2._held.GetComponent <FakeParent>();
            Quaternion rotation    = inventoryItemView2._held.transform.rotation;

            TheForest.Items.Item itemCache2 = inventoryItemView2.ItemCache;
            for (int i = 0; i < repeats; i++)
            {
                if (noconsume)
                {
                    Vector3 pos = originalPos;
                    if (i > 0)
                    {
                        // pos += 0.5f * up * (i + 1) / 3;
                        pos += 0.5f * right * (((i - 1) % 3) - 1);
                    }

                    GameObject gameObject = (!(bool)component || component.gameObject.activeSelf) ? Object.Instantiate(itemCache2._ammoPrefabs.GetPrefabForBonus(inventoryItemView.ActiveBonus, true).gameObject, pos, rotation) : Object.Instantiate(itemCache2._ammoPrefabs.GetPrefabForBonus(inventoryItemView.ActiveBonus, true).gameObject, pos, rotation);

                    gameObject.transform.localScale *= ModdedPlayer.instance.ProjectileSizeRatio;

                    try
                    {
                        gameObject.transform.GetChild(0).gameObject.layer = 19;
                    }
                    catch (System.Exception)
                    {
                        throw;
                    }
                    gameObject.layer = 19;
                    Physics.IgnoreLayerCollision(19, 19, true);
                    if (noconsume)
                    {
                        GameObject.Destroy(gameObject, 5f);
                    }
                    else
                    {
                        if (i >= 4)
                        {
                            GameObject.Destroy(gameObject, 7);                  //if spamming arrows, delete 4th and further after really show timespan
                        }
                    }
                    if ((bool)gameObject.GetComponent <Rigidbody>())
                    {
                        if (itemCache.MatchRangedStyle(TheForest.Items.Item.RangedStyle.Shoot))
                        {
                            gameObject.GetComponent <Rigidbody>().AddForce(gameObject.transform.TransformDirection(Vector3.forward * (0.016666f / Time.fixedDeltaTime) * ModdedPlayer.instance.ProjectileSpeedRatio * itemCache._projectileThrowForceRange), ForceMode.VelocityChange);
                        }
                        else
                        {
                            float num = Time.time - _weaponChargeStartTime;
                            if (ForestVR.Enabled)
                            {
                                gameObject.GetComponent <Rigidbody>().AddForce(inventoryItemView2._held.transform.up * ModdedPlayer.instance.ProjectileSpeedRatio * itemCache._projectileThrowForceRange);
                            }
                            else
                            {
                                Vector3 proj_force = forceUp * ModdedPlayer.instance.ProjectileSpeedRatio * Mathf.Clamp01(num / itemCache._projectileMaxChargeDuration) * (0.016666f / Time.fixedDeltaTime) * itemCache._projectileThrowForceRange;
                                var     proj_rb    = gameObject.GetComponent <Rigidbody>();
                                if (GreatBow.isEnabled)
                                {
                                    proj_force        *= 1.1f;
                                    proj_rb.useGravity = false;
                                }
                                if (SpellActions.BIA_bonusDamage > 0)
                                {
                                    proj_force        *= 1.1f;
                                    proj_rb.useGravity = false;
                                    if (ModReferences.bloodInfusedMaterial == null)
                                    {
                                        ModReferences.bloodInfusedMaterial = BuilderCore.Core.CreateMaterial(new BuilderCore.BuildingData()
                                        {
                                            EmissionColor = new Color(0.6f, 0, 0),
                                            renderMode    = BuilderCore.BuildingData.RenderMode.Opaque,
                                            MainColor     = Color.red,
                                            Metalic       = 1f,
                                            Smoothness    = 0.9f,
                                        });
                                    }
                                    var trail = gameObject.AddComponent <TrailRenderer>();
                                    trail.widthCurve      = new AnimationCurve(new Keyframe[] { new Keyframe(0f, 1f, 0f, 0f), new Keyframe(0.5f, 1f, 0f, 0f), new Keyframe(1f, 0.006248474f, 0f, 0f), });
                                    trail.material        = ModReferences.bloodInfusedMaterial;
                                    trail.widthMultiplier = 0.85f;
                                    trail.time            = 2.5f;
                                    trail.autodestruct    = false;
                                }
                                proj_rb.AddForce(proj_force);
                            }
                            if (LocalPlayer.Inventory.HasInSlot(TheForest.Items.Item.EquipmentSlot.RightHand, LocalPlayer.AnimControl._bowId))
                            {
                                gameObject.SendMessage("setCraftedBowDamage", SendMessageOptions.DontRequireReceiver);
                            }
                        }
                        inventoryItemView._held.SendMessage("OnAmmoFired", gameObject, SendMessageOptions.DontRequireReceiver);
                    }
                    if (itemCache._attackReleaseSFX != 0)
                    {
                        LocalPlayer.Sfx.SendMessage(itemCache._attackReleaseSFX.ToString(), SendMessageOptions.DontRequireReceiver);
                    }
                    Mood.HitRumble();
                }
                else
                {
                    if (itemCache._dryFireSFX != 0)
                    {
                        LocalPlayer.Sfx.SendMessage(itemCache._dryFireSFX.ToString(), SendMessageOptions.DontRequireReceiver);
                    }
                }
                if (i % 2 == 1)
                {
                    yield return(null);
                }
            }
            if (flag)
            {
                inv.UnequipItemAtSlot(itemCache._equipmentSlot, false, false, flag);
            }
            else
            {
                inv.ToggleAmmo(inventoryItemView, true);
            }

            yield break;
        }
Пример #20
0
        public void IsValidShouldReturnTrueWhenValueIsInRange()
        {
            Mood mood = (Mood)1;

            Assert.True(mood.IsValid());
        }
Пример #21
0
 public void IsEqualToWorksWithStruct()
 {
     var inLove = new Mood { Description = "In love", IsPositive = true };
     Check.ThatEnum(inLove).IsEqualTo(inLove);
 }
Пример #22
0
 public Cat(string color, int age, string name, List<string> peculiarities = null)
     : base(name, color, age, "Meow!")
 {
     this.Peculiarities = peculiarities ?? new List<string>();
     this.mood = Mood.Awake;
 }
Пример #23
0
        public void Test_ReturnExpectedSeparatedMoodWithReason_OnWorkday(Workday workday, Mood mood, Reason reason)
        {
            var class1 = new Class1();

            class1.GetMoodWithReasonForWorkday(workday).Mood.Should().Be(mood);
            class1.GetMoodWithReasonForWorkday(workday).Reason.Should().Be(reason);
        }
Пример #24
0
 private void CalculateMood()
 {
     this.mood = MoodFactory.GenerateMood(this.food.Sum(f => f.Happiness));
 }
Пример #25
0
    /*--------------------------------------------------------------------------------*/

    public static float getValence(Mood mood)
    {
        return(mappings[(int)mood][0]);
    }
Пример #26
0
 public Gandalf(List <Food> foods)
 {
     this.Foods  = foods;
     this.points = this.GetPoints(this.Foods);
     this.mood   = moodF.GetMood(this.points);
 }
Пример #27
0
        static void Main(string[] args)
        {
            //1. Strings Manipulation
            String[] stringsList = new String[] { "alan", "betty", "copper", "danny", "ellen", "alex" };

            int index = 0;

            foreach (String s in stringsList)
            {
                stringsList[index] = s.ToUpper();
                index++;
            }

            String[] stringsList2 = (String[])stringsList.Clone();

            List <String> stringsList3 = stringsList2.ToList();

            Action <String> printElement = s => Console.Write(s + " ");

            Func <String, Boolean> checkFirstLetter = s => s.ToLower().StartsWith("d");

            //Note: Func bool (predicate)

            stringsList3.ForEach(s => printElement(checkFirstLetter(s).ToString()));
            Console.WriteLine();

            stringsList3.ForEach(s => printElement(String.Concat(s, "2")));
            Console.WriteLine();

            stringsList3.ForEach(s => printElement(s));   //Note: above lambda preserves stringsList3
            Console.WriteLine();

            stringsList3.ForEach(s => printElement(s.Equals("BETTY").ToString()));
            Console.WriteLine();

            stringsList3.ForEach(s => printElement(s.ToLower().Replace('o', 'a')));
            Console.WriteLine();

            stringsList3.ForEach(s => printElement(s.Remove(0, 2)));
            Console.WriteLine();

            List <String> stringList4 = stringsList3.ElementAt(0).Split('A').ToList();

            stringList4.ForEach(s => printElement(s));

            Console.WriteLine("length of string at index 0 is: " + stringsList3.ElementAt(0).Length);

            /*result:
             * False False False True False False
             * ALAN2 BETTY2 COPPER2 DANNY2 ELLEN2 ALEX2
             * ALAN BETTY COPPER DANNY ELLEN ALEX
             * False True False False False False
             * alan betty capper danny ellen alex
             * AN TTY PPER NNY LEN EX
             * L N length of string at index 0 is: 4 */


            //2. Formatting and Math class

            //casting
            string x1 = "2";
            double z1 = double.Parse(x1);
            int    y1 = Int32.Parse(x1);

            int    y = 2;
            double z = Convert.ToDouble(y);
            string x = Convert.ToString(y);

            Console.WriteLine("converted values: {0},{1},{2},{3}", z1, y1, z, x);
            Console.WriteLine("formatted values: {0:0.0},{1:0.00},{2:0.#},{3}", z1, y1, z, x);
            //result: formatted values: 2.0,2.00,2,2
            Console.WriteLine("converted values: ${0:0.00}", 55.5); //result: $55.50

            //Math
            //max,min,pow,round,abs,floor,ceiling

            Console.WriteLine(Math.Round(1.77));   //result: 2
            Console.WriteLine(Math.Round(1.47));   //result: 1
            Console.WriteLine(Math.Floor(1.77));   //result: 1
            Console.WriteLine(Math.Ceiling(1.77)); //result: 2
            Console.WriteLine(Math.Min(1, 7));     //result: 1
            Console.WriteLine(Math.Abs(-1.5));     //result: 1.5
            Console.WriteLine(Math.Pow(2, 3));     //result: 8
            Console.WriteLine(9 % 2);              //result: 1


            //3. Switch statements and Enums (to add enums associated ints)
            //note: enum variable can be used as a data type,
            //enum has to be intialised,
            //enum has to be explicitly type casted

            Mood mood = new Mood();

            switch (mood)
            {
            case Mood.happy:
                break;

            case Mood.moody:
                break;

            case Mood.rageMode:
                break;

            case Mood.sad:
                break;

            case Mood.sulky:
                break;

            default:
                break;
            }

            int moodIndex = (int)Mood.happy;

            Console.WriteLine("mood index is: " + moodIndex); //result: mood index is 2


            //4. Collections (Regular, Generic)
            //Regular - ArrayList, Hashtable (todo)
            List <String> newList = new List <String>()
            {
                "abc", "abc2", "abc3"
            };

            Console.WriteLine(newList.Count());
            printList(newList);

            Console.WriteLine(newList.Contains("abc4"));

            Console.WriteLine(newList.IndexOf("abc3"));

            newList.Insert(1, "abc1");
            printList(newList);

            newList.Remove("abc");
            printList(newList);

            newList.RemoveAt(1);
            printList(newList);

            newList.Reverse();
            printList(newList);

            newList.Sort();
            printList(newList);

            newList.ToArray();
            Console.WriteLine("array is: " + String.Join(",", newList));

            List <String> stringList = new List <string>()
            {
                "1", "2", "3"
            };
            List <int> intList = stringList.Select(int.Parse).ToList(); //convert type of list

            printList(intList);

            newList.Clear();

            //Generic - Dictionary, List, Queue, Stack, SortedList
            //(todo)


            //5. Functional Programming
            List <Horse> horseList = new List <Horse>()
            {
                new Horse("Horse E", "nayyy5", new Owner("Owner 1")),
                new Horse("Horse B", "nayyy2", new Owner("Owner 1")),
                new Horse("Horse A", "nayyy2", new Owner("Owner 3")),
                new Horse("Horse C", "nayyy3", new Owner("Owner 2")),
                new Horse("Horse D", "nayyy4", new Owner("Owner 1")),
                new Horse("Horse A2", "nayyy1", new Owner("Owner 3"))
            };

            printList(horseList.GroupBy(h => h.owner.name, h => h.sound).Select(h => h.Key).ToList());
            //result: Owner 1,Owner 3,Owner 2
            printList(horseList.OrderBy(h => h.sound).Select(h => h.sound).ToList());
            //result: nayyy1,nayyy2,nayyy2,nayyy3,nayyy4,nayyy5
            printList(horseList.OrderBy(h => h.name).ThenByDescending(h => h.sound).Select(h => h.name + "" + h.sound).ToList());
            //result: Horse Anayyy2,Horse A2nayyy1, Horse Bnayyy2,Horse Cnayyy3, Horse Dnayyy4,Horse Enayyy5
            printList(horseList.Take(2).Select(h => h.name).ToList());
            //result: Horse E,Horse B
            printList(horseList.TakeWhile(h => !h.name.EndsWith("B")).Select(h => h.name).ToList());
            //result: Horse E
            printList(horseList.Skip(4).Select(h => h.sound).ToList());
            //result: nayyy4,nayyy1
            printList(horseList.SkipWhile(h => h.name.EndsWith("E")).Select(h => h.sound).ToList());
            //result: nayyy2,nayyy2,nayyy3,nayyy4,nayyy1
            printList(horseList.ToDictionary(h => h.name, h => h.sound).ToList());
            //result: [Horse E, nayyy5],[Horse B, nayyy2],[Horse A, nayyy2],[Horse C, nayyy3],[Horse D, nayyy4],[Horse A2, nayyy1]


            //6. Others (exploring)
            int?ans1 = 1;
            int?ans2 = null;

            int reply1 = ans1 ?? 0;
            int reply2 = ans2 ?? 0;

            Console.WriteLine("testing operator ??: reply 1 is... {0} reply 2 is... {1}", reply1, reply2);
            //result: ...1 ...0
        }
        //RANGED MOD CHANGES---------------------------------------------------


        protected override void FireRangedWeapon()
        {
            if (ModSettings.IsDedicated)
            {
                return;
            }
            InventoryItemView inventoryItemView = _equipmentSlots[0];

            TheForest.Items.Item itemCache = inventoryItemView.ItemCache;
            bool flag  = itemCache._maxAmount < 0;
            bool flag2 = false;

            if (flag || RemoveItem(itemCache._ammoItemId, 1, false, true))
            {
                InventoryItemView    inventoryItemView2 = _inventoryItemViewsCache[itemCache._ammoItemId][0];
                TheForest.Items.Item itemCache2         = inventoryItemView2.ItemCache;
                FakeParent           component          = inventoryItemView2._held.GetComponent <FakeParent>();
                if (UseAltWorldPrefab)
                {
                    Debug.Log("Firing " + itemCache._name + " with '" + inventoryItemView.ActiveBonus + "' ammo (alt=" + UseAltWorldPrefab + ")");
                }
                GameObject gameObject = (!(bool)component || component.gameObject.activeSelf) ? Object.Instantiate(itemCache2._ammoPrefabs.GetPrefabForBonus(inventoryItemView.ActiveBonus, true).gameObject, inventoryItemView2._held.transform.position, inventoryItemView2._held.transform.rotation) : Object.Instantiate(itemCache2._ammoPrefabs.GetPrefabForBonus(inventoryItemView.ActiveBonus, true).gameObject, component.RealPosition, component.RealRotation);
                gameObject.transform.localScale *= ModdedPlayer.instance.ProjectileSizeRatio;
                if ((bool)gameObject.GetComponent <Rigidbody>())
                {
                    if (itemCache.MatchRangedStyle(TheForest.Items.Item.RangedStyle.Shoot))
                    {
                        gameObject.GetComponent <Rigidbody>().AddForce(gameObject.transform.TransformDirection(Vector3.forward * (0.016666f / Time.fixedDeltaTime) * ModdedPlayer.instance.ProjectileSpeedRatio * itemCache._projectileThrowForceRange), ForceMode.VelocityChange);
                    }
                    else
                    {
                        float num = Time.time - _weaponChargeStartTime;
                        if (ForestVR.Enabled)
                        {
                            gameObject.GetComponent <Rigidbody>().AddForce(inventoryItemView2._held.transform.up * ModdedPlayer.instance.ProjectileSpeedRatio * itemCache._projectileThrowForceRange);
                        }
                        else
                        {
                            gameObject.GetComponent <Rigidbody>().AddForce(inventoryItemView2._held.transform.up * ModdedPlayer.instance.ProjectileSpeedRatio * Mathf.Clamp01(num / itemCache._projectileMaxChargeDuration) * (0.016666f / Time.fixedDeltaTime) * itemCache._projectileThrowForceRange);
                        }
                        if (LocalPlayer.Inventory.HasInSlot(TheForest.Items.Item.EquipmentSlot.RightHand, LocalPlayer.AnimControl._bowId))
                        {
                            gameObject.SendMessage("setCraftedBowDamage", SendMessageOptions.DontRequireReceiver);
                        }
                    }
                    inventoryItemView._held.SendMessage("OnAmmoFired", gameObject, SendMessageOptions.DontRequireReceiver);
                }
                if (itemCache._attackReleaseSFX != 0)
                {
                    LocalPlayer.Sfx.SendMessage(itemCache._attackReleaseSFX.ToString(), SendMessageOptions.DontRequireReceiver);
                }
                Mood.HitRumble();
            }
            else
            {
                flag2 = true;
                if (itemCache._dryFireSFX != 0)
                {
                    LocalPlayer.Sfx.SendMessage(itemCache._dryFireSFX.ToString(), SendMessageOptions.DontRequireReceiver);
                }
            }
            if (flag)
            {
                UnequipItemAtSlot(itemCache._equipmentSlot, false, false, flag);
            }
            else
            {
                ToggleAmmo(inventoryItemView, true);
            }
            _weaponChargeStartTime = 0f;
            SetReloadDelay((!flag2) ? itemCache._reloadDuration : itemCache._dryFireReloadDuration);
            _isThrowing = false;
        }
Пример #29
0
 public Mood_wrapper(Mood pi)
 {
     pronoun_index = pi;
 }
Пример #30
0
 public MoodFactory()
 {
     mood = new Mood();
 }
Пример #31
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "XmppUserMoodEvent">XmppUserMoodEvent</see> class.
 /// </summary>
 /// <param name = "user">User contact</param>
 /// <param name = "mood">User mood</param>
 public XmppUserMoodEvent(XmppContact user, Mood mood)
     : base(user)
 {
     this.mood = mood.MoodType.ToString();
     text      = mood.Text;
 }
Пример #32
0
    /*--------------------------------------------------------------------------------*/

    public static float getArousal(Mood mood)
    {
        return(mappings[(int)mood][1]);
    }
Пример #33
0
        public void WhenEnumHasNoDescriptionTagThenDescriptionReturnsEmptyString()
        {
            Mood mood = Mood.Happy;

            Assert.Equal(string.Empty, mood.Description());
        }
Пример #34
0
        public void WhenEnumHasDescriptionTagThenDescriptionShouldBeReturned()
        {
            Mood mood = Mood.Peaceful;

            Assert.Equal("Description of peaceful", mood.Description());
        }
Пример #35
0
 public void Test_AutomaticCombinationOfEnums([Values] Mood mood, [Values] Reason reason)
 {
 }
Пример #36
0
 public void AddEffectToMood(Mood effect)
 {
     currentMood = currentMood + effect;
 }
Пример #37
0
 private bool FeelingExists(Mood id)
 {
     return(_context.Feeling.Any(e => e.FeelingId == id));
 }
Пример #38
0
        public void IsNullOrDefaultShouldReturnFalseWhenValueIsNotDefault()
        {
            Mood mood = Mood.Peaceful;

            Assert.False(mood.IsNullOrDefault());
        }
Пример #39
0
        public void IsValidShouldReturnFalseWhenValueIsOutOfRange()
        {
            Mood mood = (Mood)300;

            Assert.False(mood.IsValid());
        }
Пример #40
0
 /// <summary>
 /// Returns the XMPP element name of the specified mood value.
 /// </summary>
 /// <param name="mood">A value from the Mood enumeration
 /// to convert into an element name.</param>
 /// <returns>The XML element name of the specified mood value.</returns>
 private string MoodToTagName(Mood mood)
 {
     StringBuilder b = new StringBuilder();
     string s = mood.ToString();
     for (int i = 0; i < s.Length; i++)
     {
         if (char.IsUpper(s, i) && i > 0)
             b.Append('_');
         b.Append(char.ToLower(s[i]));
     }
     return b.ToString();
 }
Пример #41
0
        /// <summary>
        /// Populates this <see cref="Emotion"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the emotion data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a emotion node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator emotionNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("emotion");

            Validator.ThrowInvalidIfNull(emotionNav, "EmotionUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(emotionNav.SelectSingleNode("when"));

            XPathNavigator moodNav =
                emotionNav.SelectSingleNode("mood");

            if (moodNav != null)
            {
                _mood = (Mood)moodNav.ValueAsInt;
            }

            XPathNavigator stressNav =
                emotionNav.SelectSingleNode("stress");

            if (stressNav != null)
            {
                _stress = (RelativeRating)stressNav.ValueAsInt;
            }

            XPathNavigator wellbeingNav =
                emotionNav.SelectSingleNode("wellbeing");

            if (wellbeingNav != null)
            {
                _wellbeing = (Wellbeing)wellbeingNav.ValueAsInt;
            }
        }
Пример #42
0
        /// <summary>
        /// Pets the Cat.
        /// </summary>
        /// <returns>Meow, if everything is ok.</returns>
        public string Pet()
        {
            if (this.mood != Mood.Sleepy)
            {
                this.mood = Mood.Happy;
                return GetVoice();
            }

            return $"{this.Name} doesn't want to be pet and scratches you instead!{Environment.NewLine}";
        }
Пример #43
0
    //public void Update()
    //{
    //    /// Update MOOD From ID
    //    Speaker s = GetComponent<Speaker>();
    //    if (s != null && s.Tags != null)
    //    {
    //    //    Tag t = s.Tags.Find(x => x != null && x._Key.ToLower() == "mood");
    //    //    if (t != null)
    //    //    {
    //    //        if (t._Value.ToLower() == "happy")
    //    //            MoodChange(Mood, Mood.Happy);
    //    //        else
    //    //            MoodChange(Mood, Mood.Sad);
    //    //    }
    //    }
    //}
    private void MoodChange(Mood argOldMood, Mood argNewMood)
    {
        //		//debug.log("MOOD CHANGE" + name);
        HideMood();
        WorldGUI.Mode = WorldGUI.Mode;

        if (OnMoodChange != null)
            OnMoodChange(argOldMood, argNewMood);
    }
Пример #44
0
 public async Task <List <Song> > GetSongsByMood(Mood mood)
 {
     return(await _songRepository.GetSongsByMood(mood));
 }
Пример #45
0
 public static T AddMoodCondition <T>(this T node, Mood speakerMood, Mood listenerMood) where T : BaseNode
 {
     node.Conditions.Add(new MoodCondition(new[] { speakerMood }, new[] { listenerMood }));
     return(node);
 }
Пример #46
0
        public void IsNullOrDefaultShouldReturnTrueWhenValueIsDefault()
        {
            Mood mood = Mood.Bored;

            Assert.True(mood.IsNullOrDefault((int)Mood.Bored));
        }
Пример #47
0
        public void Init(int index)
        {
            //int r = Random.Range(0, skinList.Count);
            //skeletonGraphic.initialSkinName = skinList[r];
            //skeletonGraphic.Skeleton.SetSkin(skinList[r]);
            //skeletonGraphic.Skeleton.SetSlotsToSetupPose();
            //skeletonGraphic.AnimationState.Apply(skeletonGraphic.Skeleton);
            //skeletonGraphic.OverrideTexture = skeletonGraphic.SkeletonDataAsset.atlasAssets[r].materials[0].mainTexture;
            //skeletonGraphic.Initialize(true);

            //성별
            gender = Random.Range(0, 2) == 0 ? CitizenGenderType.Male : CitizenGenderType.Female;


            //피부색

            int r = Random.Range(0, 3);

            float skinColor = 0f;

            if (r == 0)
            {
                skinColor = Random.Range(0f, 0.06f);
            }
            if (r == 1)
            {
                skinColor = Random.Range(0.06f, 0.3f);
            }
            if (r == 2)
            {
                skinColor = Random.Range(0.3f, 0.8f);
            }


            //float skinColor = Random.Range(0f, 0.7f);
            Color colorSkin = Color.HSVToRGB(Random.Range(15f, 40f) / 360f, skinColor, 1f - skinColor);

            for (int i = 0; i < slotSkinList.Count; i++)
            {
                skeletonGraphic.Skeleton.FindSlot(slotSkinList[i]).SetColor(colorSkin);
            }

            InitPart(PartType.Hair);
            InitPart(PartType.Upper);
            InitPart(PartType.Lower);
            InitPart(PartType.AccArm);
            InitPart(PartType.AccHead);
            InitPart(PartType.AccFace);

            skeletonGraphic.AnimationState.SetAnimation(0, animationWalk, true);

            isPayTax = false;

            mood = Mood.Normal;

            this.index = index;

            int count = CitizenSpawnController.citizenList.Count(x => x.transform.position.y > transform.position.y);

            //뎁스
            rectTransform.SetSiblingIndex(count);

            //원근
            scale = CitizenSpawnController.GetCitizenScale(transform.position);

            //퇴장할 때 무드 랜덤 (임시코드)
            moodRandom = Random.Range(0, 3);

            //말풍선 숨기기
            HideBubble();

            //요구사항 초기화
            InitRequest();

            //일상 시작
            coroutineDo = StartCoroutine(Do());
        }
Пример #48
0
 public Terrier(string name, int age, Mood mood) : base(name, age, mood)
 {
 }
Пример #49
0
 /// <summary>
 /// Sets the user's mood to the specified mood value.
 /// </summary>
 /// <param name="mood">A value from the Mood enumeration to set the user's
 /// mood to.</param>
 /// <param name="description">A natural-language description of, or reason
 /// for, the mood.</param>
 /// <exception cref="InvalidOperationException">The XmppClient instance is not
 /// connected to a remote host, or the XmppClient instance has not authenticated with
 /// the XMPP server.</exception>
 /// <exception cref="ObjectDisposedException">The XmppClient object has been
 /// disposed.</exception>
 public void SetMood(Mood mood, string description = null)
 {
     AssertValid();
     userMood.SetMood(mood, description);
 }
Пример #50
0
 public Pet(string name, int age, Mood mood)
 {
     this.MoodOfPet = mood;
     this.Name      = name;
     this.Age       = age;
 }
Пример #51
0
    // private void UpdateColliders () {
    //     foreach (Collider2D c in angryColliders) {
    //         //c.isTrigger = (mood == Mood.Angry);
    //         if (mood == Mood.Angry) {
    //             c.gameObject.layer = 10;
    //         } else {
    //             if (c.gameObject.GetComponent<EdgeCollider2D>() != null) {
    //                 c.gameObject.layer = 9;
    //             } else {
    //                 c.gameObject.layer = 0;
    //             }
    //         }
    //     }
    //     foreach (Collider2D c in happyColliders) {
    //         //c.isTrigger = (mood == Mood.Happy);
    //         if (mood == Mood.Happy) {
    //             c.gameObject.layer = 10;
    //         } else {
                
    //             if (c.gameObject.GetComponent<EdgeCollider2D>() != null) {
    //                 c.gameObject.layer = 9;
    //             } else {
    //                 c.gameObject.layer = 0;
    //             }
    //         }
    //     }
    //     foreach (Collider2D c in regretfulColliders) {
    //         //c.isTrigger = (mood == Mood.Regretful);
    //         if (mood == Mood.Regretful) {
    //             c.gameObject.layer = 10;
    //         } else {
    //             if (c.gameObject.GetComponent<EdgeCollider2D>() != null) {
    //                 c.gameObject.layer = 9;
    //             } else {
    //                 c.gameObject.layer = 0;
    //             }
    //         }
    //     }
    // }

    public static Color GetColorForMood (Mood mood) {
        switch (mood) {
            case Mood.Angry:
                return new Color(0.8f, 0.3f, 0.2f);
            case Mood.Happy:
                return new Color(0.2f, 0.8f, 0.2f);
            case Mood.Regretful:
                return new Color(0.2f, 0.2f, 0.8f);
            case Mood.Purple:
                return new Color(0.9f, 0.5f, 0.9f);
			
            default:
                return new Color(1f, 0f, 1f);
        }
    }
Пример #52
0
 public SheepDog(string name, int age, Mood mood) : base(name, age, mood)
 {
 }
Пример #53
0
        public static IEnumerable<string> ExtractReviews(string filePath, Mood mood)
        {
            string contents;
            if (!File.Exists(filePath)) throw new Exception(string.Format("Unable to locate {0}", filePath));
            using (var sr = new StreamReader(filePath, Encoding.UTF7))
            {
                contents = sr.ReadToEnd();
            }

            contents = EscapeXmlContents(contents); //Escape all special characters
            contents = SanitizeXmlString(contents); //Remove any hex characters

            var xDoc = new XmlDocument();
            xDoc.LoadXml(contents);

            var results = new List<string>();
            var localCount = 0;
            foreach (XmlNode review in xDoc.SelectNodes("//review"))
            {
                var productName = review.SelectSingleNode("product_name").InnerText.Replace("\n","");
                var productReview = review.SelectSingleNode("review_text").InnerText;
                localCount++;
                if (mood == Mood.POSITIVE)
                {
                    _positiveReviewCount++;
                    Logger.DebugFormat("Positive[{0}.{1}] Parsing review {2}", _positiveReviewCount, localCount, productName);
                }
                else
                {
                    _negativeReviewCount++;
                    Logger.DebugFormat("Negative[{0}.{1}] Parsing review {2}", _negativeReviewCount, localCount, productName);
                }

                results.Add(productReview);
            }

            return results;
        }
Пример #54
0
 public Cat(string name, int age, Mood mood) : base(name, age, mood)
 {
 }
Пример #55
0
        /// <summary>
        /// Orders the Cat to take a nap.
        /// </summary>
        /// <returns>Meow, if everything is ok.</returns>
        public string TakeANap()
        {
            if (this.mood == Mood.Sleepy)
            {
                var r = new Random();
                var sleepTime = r.Next(10);

                for (var i = 0; i < sleepTime; i++)
                {
                    Console.WriteLine($"zzzZZZzzz");
                }

                this.mood = Mood.Happy;

                return GetVoice();
            }
            else
            {
                this.mood = Mood.Grumpy;
                return $"{this.Name} doesn't want to sleep!";
            }
        }
Пример #56
0
 /// <summary>
 /// Changes mood
 /// </summary>
 /// <param name="mood">New mood</param>
 private void ChangeMood(Mood mood)
 {
     this.Feeling = mood;
     _moodTime    = 0;
 }
Пример #57
0
 /// <summary>
 /// Feed the Cat.
 /// </summary>
 /// <returns>Meow, if everything is ok.</returns>
 public string Feed()
 {
     this.IsHungry = false;
     this.mood = Mood.Sleepy;
     return GetVoice();
 }
Пример #58
0
        public async Task <int> SetMood(T obj, string user)
        {
            Mood mood = _mapper.Map <Mood>(obj);

            return(await _repository.SetMood(mood, user));
        }
Пример #59
0
 public void setMood(Mood mood)
 {
     int id = GetMoodSequence(mood);
     if(spriteSheet.currentSequence!=id){
         spriteSheet.CurrentSequence = id;
     }
 }
Пример #60
0
 public void UpdateMood(Mood mood)
 {
     Mood = mood;
     MoodEvent.Invoke(Mood);
 }