public List <Portrait> portraitTransitions; //list of portrait types as well as times to set the character talking to, visually public Dialogue(int id, Dictionary <string, object> input) { shortText = (string)input["shortText"]; longText = (string)input["longText"]; speaker = (string)input["speaker"]; ID = id + 2;//the spreadsheet is offset by 2 from the true value so w/e store it as its marked defaultOption = (int)input["default"]; maxTimer = (float)input["maxTimer"]; maxStressTimePenalty = (float)input["maxStressTimePenalty"]; //building options list int n = 0; options = new List <int>(); string s = (string)input["options"]; foreach (string st in s.Replace("a", "").Split(',')) { ++n; options.Add(int.Parse(st.Trim())); } //building stressCosts list using n from last list s = (string)input["stressCost"]; string[] toGrabFrom = s.Replace("(", "").Replace(")", "").Replace(" ", "").Split(','); stressCost = new Stress(float.Parse(toGrabFrom[0]), float.Parse(toGrabFrom[1])); //building portrait list using n from last list s = (string)input["portraitTransitions"]; portraitTransitions = new List <Portrait>(); toGrabFrom = s.Replace("(", "").Replace(")", "").Replace(" ", "").Split(','); for (int i = 0; i < toGrabFrom.Length; i += 2) { portraitTransitions.Add(new Portrait(toGrabFrom[i], float.Parse(toGrabFrom[i + 1]))); } }
protected virtual void CheckForCharacterCollision(Collision2D collision) { if (actionActivated) { return; } if (!collision.gameObject.CompareTag("Character")) { return; } //dont hurt anxiety if his ability is active Anxiety anxiety = collision.gameObject.GetComponent <Anxiety>(); Stress stress = collision.gameObject.GetComponent <Stress>(); if (anxiety) { if (anxiety.abilityActive) { return; } } if (stress) { if (stress.abilityActive) { return; } } KillCharacter(); }
public async Task <IActionResult> PutStress([FromRoute] int id, [FromBody] Stress stress) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stress.stress_id) { return(BadRequest()); } _context.Entry(stress).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StressExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
internal static string ExpandLine(string line) { var obj = new EntryParser(line).Parse(); var entry = obj as Статья; if (entry == null) { return(null); } string lemma; string symbol; int[] secAccPos; new EntryParser(line).ParseCommonPart(out lemma, out symbol, out secAccPos); bool failed = false; var forms = FormGenerator.GetAccentedFormsWithCorrectCase(line, delegate { failed = true; }); if (failed) { return(null); } return(lemma + "," + symbol + "," + string.Join(",", forms.Skip(1) .Select(form => Stress.StripStressMarks(form.AccentedForm)))); }
public override int GetHashCode() { unchecked { int hashCode = Location.GetHashCode(); hashCode = (hashCode * 397) ^ Stress.GetHashCode(); return(hashCode); } }
public Vertex(Vertex vertex) { X = vertex.X; Y = vertex.Y; dX = vertex.dX; dY = vertex.dY; strain = vertex.strain; stress = vertex.stress; }
public UnitResults(Length length, Angle angle, SectionalData sectionalData, Force force, Mass mass, Displacement displacement, Stress stress) { this.Length = length; this.Angle = angle; this.SectionalData = sectionalData; this.Force = force; this.Mass = mass; this.Displacement = displacement; this.Stress = stress; }
public void DerivedUnits_SpeedTest() { var total = Stress.ZeroStress; for (int i = 0; i < 1E7; i++) { var stress = new Stress(5, Stress.PSI); total += stress; } Assert.Pass(); }
private void DoItemAdd(DateTime when, Mood mood, Stress stress, Wellbeing wellbeing) { EmotionalStateModel emotion = new EmotionalStateModel(); emotion.When = when; emotion.Mood = mood; emotion.Stress = stress; emotion.Wellbeing = wellbeing; this.EmotionList.Add(emotion); }
public async Task <IActionResult> PostStress([FromBody] Stress stress) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.stresses.Add(stress); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStress", new { id = stress.stress_id }, stress)); }
void FindCharactersInLevel() { foreach (Character character in FindObjectsOfType <Character>()) { character.Init(); charactersInLevel.Add(character); // Debug.Log("Found character: " + character.name); } apathy = Instantiate(apathyPrefab); stress = Instantiate(stressPrefab); frustration = Instantiate(frustrationPrefab); charactersInLevel.Add(apathy); charactersInLevel.Add(stress); charactersInLevel.Add(frustration); }
void UpdateWordFormsZip() { string txtFile = server.MapPath("~/download/wordforms.txt"); UpdateFile(wordformsZipAppRelativePath, tmpFilePath => { var wordforms = File.ReadAllLines(ZalizniakFilePath, Encoding.GetEncoding(1251)) .AsParallel() .Select(line => FormGenerator.GetAccentedForms(line, delegate {}).ToArray()) .SelectMany(forms => forms) .Select(form => Stress.StripStressMarksAndYo(form.AccentedForm)) .OrderBy(form => form, StringComparer.Ordinal) .Distinct(); File.WriteAllLines(txtFile, wordforms); new ZipArchive(txtFile).ZipSingleFile(tmpFilePath); }); }
// Use this for initialization void Start() { boxCollider = GetComponent <BoxCollider2D>(); rigibody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); playerStress = GetComponent <Stress>(); //rageDialog = transform.GetChild(1).GetComponent<GameObject>(); rageDialog.SetActive(false); InitializeAnimator(); currentDoor = null; currentTask = null; isPlayerStunned = false; stunDuration = 3; currentlyRunning = false; currentlyCrossing = false; currentlyWorking = false; workingDuration = 0.5f; if (playerCanvas == null) { Debug.Log("FALTA ASIGNAR EL PLAYER_CANVAS"); } else { stressImage = playerCanvas.transform.GetChild(0).GetComponent <Image>().transform.GetChild(0).GetComponent <Image>(); keyText = playerCanvas.transform.GetChild(2).GetComponent <Text>(); } changeSolveTaskKeyAtRandom(); }
static void Main(string[] args) { //Stress Test Person obj = new Person(); Console.WriteLine("Insert your name: "); obj.Name = Console.ReadLine(); Console.WriteLine("Insert your Heartbeats Per Minute: "); var tempBPM = Console.ReadLine(); obj.NumberOfHeartBeatsPerMin = Convert.ToInt64(tempBPM); Stress objStress = new Stress(); objStress.Stresslevel(obj); //Caffeine Test Console.WriteLine(); Console.WriteLine(); Caffeine Cobj = new Caffeine(); Cobj.DrinkUp(500); Cobj.DrinkUp(160); }
private bool Equals(MacroStabilityInwardsPreconsolidationStress other) { return(Location.Equals(other.Location) && Stress.Equals(other.Stress)); }
/// <summary> /// add the associated stress values to each character from the passed stress struct /// </summary> // <param name="StressVal"></param> public void UpdateStress(Stress StressVal) { GavinStress += StressVal.gavStress; PerpStress += StressVal.perpStress; //Debug.Log("GavStress: " + GavinStress + "\nRA9Stress: " + PerpStress); }
public void CalculateBorderTileHeights() { // if perpendicular motion is +ve, it's a collision. // -ve, it's a rift (which would form basaltic volcanoes) // If collision, then // if heights sufficiently close & same sign, treat as height increase // mountain formation; folding; // if heights opposite sign; subduct the lower under the higher. // tilt upper plate (calc for all boundaries) foreach (int borderCornerKey in borderCorners.Keys) { List <Int64> borderIndices = borderCorners[borderCornerKey].borderIndices; if (borderIndices.Count == 3) { // At 3 plate boundaries, just take some maxima / averages: Plate plate0 = GetPlates()[VertexToPlates[geometry.Topology.Centroids[borderCornerKey].Faces[0]]]; Plate plate1 = GetPlates()[VertexToPlates[geometry.Topology.Centroids[borderCornerKey].Faces[1]]]; Plate plate2 = GetPlates()[VertexToPlates[geometry.Topology.Centroids[borderCornerKey].Faces[2]]]; Stress stress = borderCorners[borderCornerKey].stress; if (stress.pressure > 0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, Math.Max(plate1.Traits.Elevation, plate2.Traits.Elevation)) + stress.pressure; } else if (stress.pressure < -0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, Math.Max(plate1.Traits.Elevation, plate2.Traits.Elevation)) + stress.pressure / 4; } else if (stress.shear > 0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, Math.Max(plate1.Traits.Elevation, plate2.Traits.Elevation)) + stress.shear / 8; } else { borderCorners[borderCornerKey].elevation = (plate0.Traits.Elevation + plate1.Traits.Elevation + plate2.Traits.Elevation) / 3.0f; } } else { Border border0 = borders[borderIndices[0]]; Border border1 = borders[borderIndices[1]]; int plateIndex0 = border0.plate0; int plateIndex1 = border1.plate0 == plateIndex0 ? border1.plate1 : border0.plate1; Plate plate0 = GetPlates()[plateIndex0]; Plate plate1 = GetPlates()[plateIndex1]; ElevationCalculation elevationCalculation = ElevationCalculation.DORMANT; Stress stress = borderCorners[borderCornerKey].stress; if (stress.pressure > 0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, plate1.Traits.Elevation) + stress.pressure; if (plate0.Traits.Elevation < 0 && plate0.Traits.Elevation < 0) { elevationCalculation = ElevationCalculation.COLLIDING; } else if (plate0.Traits.Elevation < 0) { elevationCalculation = ElevationCalculation.SUBDUCTING; } else if (plate1.Traits.Elevation < 0) { elevationCalculation = ElevationCalculation.SUPERDUCTING; } else { elevationCalculation = ElevationCalculation.COLLIDING; } } else if (stress.pressure < -0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, plate1.Traits.Elevation) + stress.pressure / 4; elevationCalculation = ElevationCalculation.DIVERGING; } else if (stress.shear > 0.3) { borderCorners[borderCornerKey].elevation = Math.Max(plate0.Traits.Elevation, plate1.Traits.Elevation) + stress.shear / 8; elevationCalculation = ElevationCalculation.SHEARING; } else { borderCorners[borderCornerKey].elevation = (plate0.Traits.Elevation + plate1.Traits.Elevation) / 2.0f; elevationCalculation = ElevationCalculation.DORMANT; } // Queue up: // next corner: Inner corner: the corner that isn't the opposite corner of border0 and border1 // (i.e. remove the opposite corners from Centroid neighbours, and it's the remaining one). // origin: { this corner, stress, plate, elevationType } // border: inner border // corner: this corner // distanceToPlateBoundary: inner border length, i.e. of next corner. } } }
public void CalculateStresses() { // for each vertex in plate boundaries, // calculate relative motion between tiles // both parallel to (shear) and perpendicular to (pressure) edge. foreach (int borderCornerKey in borderCorners.Keys) { List <Int64> borderIndices = borderCorners[borderCornerKey].borderIndices; var centroid = geometry.Topology.Centroids[borderCornerKey]; var pos = centroid.position; Dictionary <int, Vector3> plateMovement = new Dictionary <int, Vector3>(); foreach (Int64 borderKey in borderIndices) { Border border = borders[borderKey]; // Calculate movement only once for each plate for (int i = 0; i < 2; ++i) { int plateIndex = (i == 0) ? border.plate0 : border.plate1; Vector3 movement; if (!plateMovement.TryGetValue(plateIndex, out movement)) { Plate plate = GetPlates()[plateIndex]; movement = plate.CalculateSpin(pos) + plate.CalculateDrift(pos); plateMovement[plateIndex] = movement; } } } if (borderIndices.Count == 3) { // 3 separate plates. Find movement from each plate at this corner and average it Stress[] stresses = new Stress[3]; int stressIdx = 0; foreach (Int64 borderKey in borderIndices) { Border border = borders[borderKey]; int oppositeCornerIndex = border.OppositeCorner(borderCornerKey); var oppositeCornerPosition = geometry.Topology.Centroids[oppositeCornerIndex].position; Vector3 boundary = oppositeCornerPosition - pos; Vector3 boundaryNormal = Vector3.Cross(boundary, pos); stresses[stressIdx++] = calculateStress(plateMovement[border.plate0], plateMovement[border.plate1], boundary, boundaryNormal); } borderCorners[borderCornerKey].stress.pressure = (stresses[0].pressure + stresses[1].pressure + stresses[2].pressure) / 3.0f; borderCorners[borderCornerKey].stress.shear = (stresses[0].shear + stresses[1].shear + stresses[2].shear) / 3.0f; } else // Border between only 2 plates. { // generate average vector, calculate stress once. Border border0 = borders[borderIndices[0]]; Border border1 = borders[borderIndices[1]]; int plate0 = border0.plate0; int plate1 = border1.plate0 == plate0 ? border1.plate1 : border0.plate1; int oppositeCornerIndex0 = border0.OppositeCorner(borderCornerKey); int oppositeCornerIndex1 = border0.OppositeCorner(borderCornerKey); var oppositeCornerPosition0 = geometry.Topology.Centroids[oppositeCornerIndex0].position; var oppositeCornerPosition1 = geometry.Topology.Centroids[oppositeCornerIndex1].position; Vector3 boundary = oppositeCornerPosition1 = oppositeCornerPosition0; Vector3 boundaryNormal = Vector3.Cross(boundary, pos); borderCorners[borderCornerKey].stress = calculateStress(plateMovement[plate0], plateMovement[plate1], boundary, boundaryNormal); } } }
private void DoItemAdd(DateTime when, Mood mood, Stress stress, Wellbeing wellbeing, String note) { EmotionalStateModel emotion = new EmotionalStateModel(); emotion.When = when; emotion.Mood = mood; emotion.Stress = stress; emotion.Wellbeing = wellbeing; emotion.Note = note; this.EmotionList.Add(emotion); }
public Vowel(Stress stress, Symbol symbol = null, int diacriticImpact = 0) : base(symbol, diacriticImpact) { this.MannerOfArticulation = Enums.MannerOfArticulation.vowel; this.Stress = stress; }
public SyllablePattern?PlaceStress(List <SyllablePattern> StressHeuristics, Word.Stress DefaultStress) { /* HebrewParser.Log.Analyzer.Write("/" + TranslitSyllables + "/"); * if (Tag != TagTypes.Unrecognized) * HebrewParser.Log.Analyzer.WriteLine(" (tagged " + Tag.ToString() + ")");*/ if (CantillationMarks.Count > 0) { StressPosition = Stress.None; for (int i = Syllables.Count - 1; (i >= 0) && (i > Syllables.Count - 3); i--) { if (Syllables[i].CantillationMarks.Count > 0) { StressPosition = (Stress)(Syllables.Count - i); if (!(Syllables[i].CantillationMarks.Contains(HebrewChar.Pashta) && (CantillationMarks.Count > 1))) { break; } } } //(" set to " + StressPosition.ToString() + " by cantillation mark"); } else if ((Tag & TagTypes.Stress) != TagTypes.Unrecognized) { switch (Tag & TagTypes.Stress) { case TagTypes.Unstressed: StressPosition = Stress.None; break; case TagTypes.Milra: StressPosition = Stress.Milra; break; case TagTypes.Milel: StressPosition = Stress.Milel; break; case TagTypes.MilelDMilel: StressPosition = Stress.MilelDMilel; break; } } else { foreach (SyllablePattern p in StressHeuristics) { if (p.Match(this)) { StressPosition = p.Result; return(p); } } StressPosition = DefaultStress; // HebrewParser.Log.Analyzer.WriteLine(" defaulted to " + StressPosition.ToString()); } if ((int)StressPosition > Syllables.Count) { StressPosition = (Stress)Syllables.Count; // HebrewParser.Log.Analyzer.WriteLine("\t^--- Falling back to " + StressPosition.ToString()); } return(null); }
public static Effect GetEffect(string param) { if (effects.ContainsKey(param)) { return(effects[param]); } string[] p = param.Split(' '); switch (p[0]) { case "Bleed": effects[param] = new Bleed(int.Parse(p[1]), int.Parse(p[2])); break; case "Counter": effects[param] = new Counter(float.Parse(p[1]), int.Parse(p[2])); break; case "Heal": effects[param] = new Heal(int.Parse(p[1])); break; case "Defend": case "Defense": effects[param] = new Defend(int.Parse(p[1])); break; case "Mark": effects[param] = new Mark(int.Parse(p[1])); break; case "Push": case "Pull": effects[param] = new PushPull(int.Parse(p[1])); break; case "Move": effects[param] = new Move(); break; case "MoveSelf": effects[param] = new MoveSelf(); break; case "Dodge": case "Damage": case "Crit": case "Acc": case "Speed": case "StressResist": effects[param] = new StatBuff(p[0], float.Parse(p[1]), int.Parse(p[2])); break; case "Block": effects[param] = new Block(int.Parse(p[1]), int.Parse(p[2])); break; case "Stun": effects[param] = new Stun(); break; case "Suprise": effects[param] = new Suprise(); break; case "Stress": case "StressHeal": effects[param] = new Stress(int.Parse(p[1])); break; case "Cleanse": effects[param] = new Cleanse(); break; case "Guard": return(new Guard(int.Parse(p[1]))); case "Metal": return(new Metal(int.Parse(p[1]))); default: Debug.Log(param); break; } return(effects[param]); }