public static void GetHappier() { if (Feelings != ld29.Feelings.VeryHappy) { Feelings = (Feelings)(int)Feelings - 1; } }
public static void GetSadder() { if (Feelings != ld29.Feelings.VerySad) { Feelings = (Feelings)(int)Feelings + 1; } }
public async Task <ActionResult <Feelings> > PostFeelings(Feelings feelings) { _context.Feelings.Add(feelings); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFeelings", new { id = feelings.Id }, feelings)); }
public async Task <IActionResult> PutFeelings(uint id, Feelings feelings) { if (id != feelings.Id) { return(BadRequest()); } _context.Entry(feelings).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeelingsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private static void Qa() { var chuck = new Character("Chuck"); var sentiment = new Feelings(); sentiment.Faith = 100; chuck.CharacterSentiment["Player"] = sentiment; while (true) { Console.Clear(); Console.Write("Press Q to ask question, A to make statement:"); var c = Console.ReadKey(); while (c.Key != ConsoleKey.Q && c.Key != ConsoleKey.A) { Console.Clear(); Console.Write("Press Q to ask question, A to make statement:"); c = Console.ReadKey(); } Console.Clear(); if (c.Key == ConsoleKey.Q) { DoSuspects(chuck); } else if (c.Key == ConsoleKey.A) { DoStatement(chuck); } } }
public async Task <IActionResult> Edit(uint id, [Bind("Id,Name")] Feelings feelings) { if (id != feelings.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(feelings); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeelingsExists(feelings.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(feelings)); }
// Use this for initialization public BDI(Agent agent) { myAgent = agent; belief = new Belief(); desire = new Desire(agent.GetType()); intention = null; perception = new Perception(myAgent); feelings = new Feelings(); reasoning = new Reasoning(); }
public async Task <IActionResult> Create([Bind("Id,Name")] Feelings feelings) { if (ModelState.IsValid) { _context.Add(feelings); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(feelings)); }
// Use this for initialization public BDI(Agent agent) { myAgent = agent; MesoGroup mesoGroup = new MesoGroup(agent.Settings.MyGroup); belief = new Belief(mesoGroup); desire = new Desire(agent.GetType()); intention = null; perception = new Perception(myAgent); feelings = new Feelings(); reasoning = new Reasoning(); }
private void UpdateSongFeelingSum(string trackUri, Feelings feeling) { if (_sumOfLikes.ContainsKey(trackUri)) { switch (feeling) { case Feelings.Dislike: _sumOfLikes[trackUri]--; break; case Feelings.Like: _sumOfLikes[trackUri]++; break; } } }
public AddMeasurement() { InitializeComponent(); var binding = new LogbookItem(); BindingContext = binding; Submit.Clicked += Submit_Clicked; Rating.Title = "How do you feel?"; Rating.ItemsSource = Feelings.GetAllFeelings().ToList(); Rating.ItemDisplayBinding = new Binding(nameof(Feeling.Name)); //Rating.BindingContext = binding.Feeling; FoodEaten.AutoSize = EditorAutoSizeOption.TextChanges; }
private void GetFeelingData() { try { if (_feelingID != -1) { Log.Info(TAG, "GetFeelingData: Attempting to find Feeling with ID - " + _feelingID.ToString()); _feeling = GlobalData.StructuredPlanFeelings.Find(feel => feel.FeelingsID == _feelingID); if (_feeling == null) { Log.Error(TAG, "GetFeelingData: _feeling is NULL"); } } } catch (Exception e) { Log.Error(TAG, "GetFeelingData: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanFeelingsDialogGetData), "StructuredPlanFeelingsDialogActivity.GetFeelingData"); } } }
private void Start() { /// Add ourself to list s_npcList.Add(this); /// Assign Values if (NPC.s_npcList.Count % 4 == 3) { myFeelings = new Feelings(0.2f, 0.2f); } else { myFeelings = new Feelings(1f, 1f); } Random.State oldState = Random.state; Random.InitState(name.Length); m_myHappinessDecay = Random.Range(150, 250); m_myMotivationDecay = Random.Range(140, 240); //Debug.Log(name.Length + ": mhd->" + myHappinessDecay + " mmd->" + myMotivationDecay); Random.state = oldState; /// Get Components foreach (var item in GetComponentsInChildren <Slider>()) { if (item.gameObject.name == "Happiness Slider") { happySlider = item; } else if (item.gameObject.name == "Motivation Slider") { motivationSlider = item; } } /// Add Components moveRef = gameObject.AddComponent <DAS.NPCMovement>(); m_modelChanger = gameObject.AddComponent <ModelChanger>(); buttonRef = gameObject.AddComponent <NpcButtons>(); buttonRef.InitNpcButtons(); buttonTogglerRef = gameObject.AddComponent <ButtonToggler>(); buttonTogglerRef.InitButtonToggler(); m_nameHolder = new GameObject("Name Holder"); m_nameHolder.transform.parent = gameObject.transform; m_myNameDisplay = m_nameHolder.AddComponent <TextMesh>(); /// Text if (m_myNameDisplay != null) { m_myNameDisplay.text = name; m_myNameDisplay.alignment = TextAlignment.Center; m_myNameDisplay.anchor = TextAnchor.MiddleCenter; m_myNameDisplay.transform.position = transform.position; m_myNameDisplay.transform.position += new Vector3(0, 3, 0); m_myNameDisplay.transform.forward = Camera.main.transform.forward; m_myNameDisplay.transform.Rotate(0, 180, 0); m_myNameDisplay.characterSize = 0.03f; m_myNameDisplay.fontSize = 155; } /// Material m_myMaterials = GetComponentInChildren <MeshRenderer>().materials; m_moneyMaterial = new Material(m_myMaterials[0]); m_moneyMaterial.color = Color.green; }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { int feelingsID = -1; string about = ""; int strength = -1; ConstantsAndTypes.REACTION_TYPE reaction = ConstantsAndTypes.REACTION_TYPE.Positive; ConstantsAndTypes.ACTION_TYPE intention = ConstantsAndTypes.ACTION_TYPE.Maintain; string actionOf = ""; base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { try { if (data.HasExtra("feelingsID")) { feelingsID = data.GetIntExtra("feelingsID", -1); } if (data.HasExtra("about")) { about = data.GetStringExtra("about"); } if (data.HasExtra("strength")) { strength = data.GetIntExtra("strength", -1); } if (data.HasExtra("reaction")) { reaction = (ConstantsAndTypes.REACTION_TYPE)data.GetIntExtra("reaction", -1); } if (data.HasExtra("intention")) { intention = (ConstantsAndTypes.ACTION_TYPE)data.GetIntExtra("intention", -1); } if (data.HasExtra("actionOf")) { actionOf = data.GetStringExtra("actionOf"); } Feelings feeling = null; if (feelingsID == -1) { //new item feeling = new Feelings(); feeling.IsNew = true; feeling.IsDirty = false; } else { feeling = GlobalData.StructuredPlanFeelings.Find(feel => feel.FeelingsID == feelingsID); feeling.IsNew = false; feeling.IsDirty = true; } feeling.AboutWhat = about; feeling.Action = intention; feeling.ActionOf = actionOf; feeling.Strength = strength; feeling.Type = reaction; feeling.Save(); if (feelingsID == -1) { GlobalData.StructuredPlanFeelings.Add(feeling); } UpdateAdapter(); } catch (Exception e) { Log.Error(TAG, "ConfirmPlanItemAddition: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanFeelingsConfirm), "StructuredPlanFeelings.ConfirmPlanItemAddition"); } } } if (resultCode == Result.Canceled) { Toast.MakeText(this, Resource.String.StructuredplanNoChangesToast, ToastLength.Short).Show(); } }
public static void AdjustTrackFeelings(this Dictionary <string, int> dictionary, string trackUri, Feelings feeling) { if (dictionary.ContainsKey(trackUri)) { switch (feeling) { case Feelings.Like: dictionary[trackUri]++; break; case Feelings.Dislike: dictionary[trackUri]--; break; default: throw new Exception($"Enum for Feelings does not exist for {feeling}"); } } else { switch (feeling) { case Feelings.Like: dictionary.Add(trackUri, 1); break; case Feelings.Dislike: dictionary.Add(trackUri, -1); break; default: throw new Exception($"Enum for Feelings does not exist for {feeling}"); } } }