public void Update(double deltaTime) { if (deltaTime == 0) { return; } foreach (IBody body in Bodies) { if (body.Dynamics.IsFixed) { continue; } // enact forces on the body foreach (ForceField field in ForceFields) { // maybe dont apply forces if we are currently inside another object? body.Dynamics.ThrustSingleFrame(field.GetForceOnBody(body), field.GetTorqueOnBody(body)); } // find and resolve contacts ContactResolver.ResolveContacts(ContactFinder.FindContacts(body, Bodies)); // update body state body.Dynamics.Update(deltaTime); } UniversalTime += deltaTime; FrameFinished?.Invoke(this, new FrameLengthArgs(deltaTime)); }
[Test] public void Parsing2Or3Names() { string senderName = "Michael McNaman"; string mail = ""; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "Michael"); Assert.IsTrue(LastName == "McNaman"); senderName = "Michael A. McNaman"; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "Michael"); Assert.IsTrue(MiddleName == "A."); Assert.IsTrue(LastName == "McNaman"); senderName = "McNaman, Michael"; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "Michael"); Assert.IsTrue(LastName == "McNaman"); senderName = "McNaman, Michael A."; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "Michael"); Assert.IsTrue(MiddleName == "A."); Assert.IsTrue(LastName == "McNaman"); }
public void DisplayNameIsCleanableGarbageTest() { _name = "\\"; ContactResolver.ResolveName(_name, null, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.AreEqual(_name, LastName, "Wrong last name"); }
public override void Save() { if (_hasChanged) { string title, fn, mn, ln, suffix, addspec; ContactResolver.ResolveName(_boxFullName.Text, null, out title, out fn, out mn, out ln, out suffix, out addspec); SaveProp(ContactManager._propTitle, title); SaveProp(ContactManager._propFirstName, fn); SaveProp(ContactManager._propMiddleName, mn); SaveProp(ContactManager._propLastName, ln); SaveProp(ContactManager._propSuffix, suffix); } if (IsOptionDiffer()) { if (_checkShowOrigNames.Checked) { _resource.SetProp(Core.ContactManager.Props.ShowOriginalNames, true); } else { _resource.DeleteProp(Core.ContactManager.Props.ShowOriginalNames); } } }
// Update is called once per frame void FixedUpdate() { foreach (Particle2DLink it in linkList) { it.CreateContacts(particleList[it.id1], particleList[it.id2]); } ContactResolver resolver = new ContactResolver(); resolver.resolveContacts(contacts); for (int i = 0; i < particleList.Count; i++) { if (particleList[i] != null) { if (Vector2.Distance(particleList[i].transform.position, target.transform.position) <= .5) { particleList[i].GetComponent <Particle2D>().Remove(); target.GetComponent <Target>().GetHit(); } Integrator.Integrate(particleList[i]); } } foreach (int itr in destroyList) { Destroy(particleList[itr]); particleList[itr] = null; } destroyList.Clear(); }
private void Awake() { if (!instance) { instance = this; } }
public void FirstNameDotLastNameExcludeExtraPrefixTest( ) { _name = "From: [email protected]"; _email = "From: [email protected]"; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(!bResolved); }
public void Long_DisplayName_Test( ) { _name = "Vasiliy Pupkin vperedi "; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(bResolved, "'" + _name + "' resolution"); Assert.AreEqual(FirstName, "Vasiliy"); Assert.AreEqual(LastName, "vperedi"); }
public void LastName_FirstName_Test( ) { _name = "Zhulin, Sergey "; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(bResolved, "'" + _name + "' resolution"); Assert.AreEqual("Sergey", FirstName, "Wrong first name"); Assert.AreEqual("Zhulin", LastName, "Wrong last name"); }
public void Null_DisplayName_Test( ) { _name = null; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsFalse(bResolved, "'" + _name + "' resolution"); Assert.AreEqual(string.Empty, FirstName); Assert.AreEqual(string.Empty, LastName); }
void Start() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } }
public CollisionManager() { ListOfNonCollidableRigidsPair = new List <NonCollidableRigidsPair>(); _contactResolver = new ContactResolver(); _data.contactCount = 0; _data.contacts = new List <Contact>(); _data.contactsLeft = 1000; _data.friction = .9f; _data.index = 0; _data.restitution = .7f; }
// Start is called before the first frame update void Start() { Debug.Log("Start"); instance = this; particleManager = this.gameObject.AddComponent <ParticleManager>(); generator = GetComponent <BouyancyGenerator>(); generator.SetShouldEffectAll(true); ForceManager.AddGenerator(generator); resolver = this.gameObject.AddComponent <ContactResolver>(); }
public void DisplayNameIsEqualToEmail_Test( ) { _name = "*****@*****.**"; _email = _name; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsFalse(bResolved, "'" + _name + "' resolution"); Assert.AreEqual(string.Empty, FirstName); Assert.AreEqual(string.Empty, LastName); }
private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } }
public void FirstNameDotLastName_DisplayNameEmpty_Test( ) { _name = string.Empty; _email = "*****@*****.**"; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsFalse(bResolved, "'" + _name + "' resolution"); Assert.AreEqual(string.Empty, FirstName); Assert.AreEqual(string.Empty, LastName); }
// Start is called before the first frame update void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
public void FirstNameDotLastName_Test( ) { _name = "*****@*****.**"; _email = "*****@*****.**"; bool bResolved = ContactResolver.ResolveName(_name, _email, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(bResolved, "'" + _name + "' resolution"); Assert.AreEqual("sergey", FirstName); Assert.AreEqual("zhulin", LastName); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Debug.LogError("More than one ContactResolver"); } }
[Test] public void CheckNameSuffixes() { string senderName = "Michael McNaman, Jr."; string mail = ""; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("Jr.") == -1); Assert.IsTrue(LastName.IndexOf("Jr.") == -1); Console.WriteLine("1. - [" + senderName + "]: " + FirstName + "|" + LastName + " | " + Suffix); senderName = "Michael L. McNaman, Sr."; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("Jr.") == -1); Assert.IsTrue(LastName.IndexOf("Jr.") == -1); Console.WriteLine("2. - [" + senderName + "]: " + FirstName + " | " + LastName + " | " + Suffix); senderName = "Michael L. McNaman, I"; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf(" I") == -1); Assert.IsTrue(LastName.IndexOf(" I") == -1); Console.WriteLine("3. - [" + senderName + "]: " + FirstName + " | " + LastName + " | " + Suffix); senderName = "Michael L. McNaman II "; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("II") == -1); Assert.IsTrue(LastName.IndexOf("II") == -1); Console.WriteLine("4. - [" + senderName + "]: " + FirstName + " | " + LastName + " | " + Suffix); senderName = "Michael L. McNaman III "; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("III") == -1); Assert.IsTrue(LastName.IndexOf("III") == -1); Console.WriteLine("5. - [" + senderName + "]: " + FirstName + " | " + LastName + " | " + Suffix); senderName = "Prof. Michael L. McNaman III "; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("Prof") == -1); Assert.IsTrue(LastName.IndexOf("Prof") == -1); Console.WriteLine("5. - [" + senderName + "]: " + Title + " | " + FirstName + " | " + LastName + " | " + Suffix); senderName = "Dr Michael L. McNaman III "; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName.IndexOf("Prof") == -1); Assert.IsTrue(LastName.IndexOf("Prof") == -1); Console.WriteLine("6. - [" + senderName + "]: " + Title + " | " + FirstName + " | " + LastName + " | " + Suffix); }
[Test] public void ParsingFullName() { string senderName = "dr. Michael A. McNaman, Jr (Email)"; string mail = ""; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(Title == "dr."); Assert.IsTrue(FirstName == "Michael"); Assert.IsTrue(MiddleName == "A."); Assert.IsTrue(LastName == "McNaman"); Assert.IsTrue(Suffix == "Jr"); Assert.IsTrue(AddSpec == "(Email)"); }
private void InitializeFields() { string title, fn, mn, ln, suffix, addspec; ContactResolver.ResolveName(_fullName, null, out title, out fn, out mn, out ln, out suffix, out addspec); _boxTitle.Text = title; _boxFirstName.Text = fn; _boxMidName.Text = mn; _boxLastName.Text = ln; _boxSuffix.Text = suffix; _boxTitle.TextChanged += OnNameTextChanged; _boxFirstName.TextChanged += OnNameTextChanged; _boxMidName.TextChanged += OnNameTextChanged; _boxLastName.TextChanged += OnNameTextChanged; _boxSuffix.TextChanged += OnNameTextChanged; }
void Update() { Debug.Log($"system fps:{1.0f / Time.deltaTime}"); Debug.Log($"fixed fps:{1.0f / fixedDT}"); fpsText.value = $"FPS: {(1.0f / Time.deltaTime).ToString("F1")}"; if (!simulate) { return; } float dt = Time.deltaTime; timeAccumulator += dt; GravitationalForce.ApplyForce(bodies, gravitation); springs.ForEach(spring => spring.applyForce()); while (timeAccumulator >= fixedDT) { bodies.ForEach(body => body.step(fixedDT)); bodies.ForEach(body => Integrator.semiImplicitEuler(body, fixedDT)); bodies.ForEach(body => body.shape.color = Color.red); if (collision) { Collision.createContacts(bodies, out List <Contact> contacts); ContactResolver.resolve(contacts); contacts.ForEach(contact => contact.bodyA.shape.color = Color.cyan); contacts.ForEach(contact => contact.bodyB.shape.color = Color.cyan); } if (wrap) { bodies.ForEach(body => body.position = Utilities.wrap(body.position, -size, size)); } timeAccumulator -= fixedDT; } bodies.ForEach(body => body.force = Vector2.zero); bodies.ForEach(body => body.acceleration = Vector2.zero); }
[Test] public void ParsingFnLnWithAddSpec() { string senderName = "FirstName LastName (JetBrains)"; string mail = ""; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "FirstName"); Assert.IsTrue(MiddleName == string.Empty); Assert.IsTrue(LastName == "LastName"); Assert.IsTrue(AddSpec == "(JetBrains)"); senderName = "FirstName MiddleName LastName (JetBrains)"; ContactResolver.ResolveName(senderName, mail, out Title, out FirstName, out MiddleName, out LastName, out Suffix, out AddSpec); Assert.IsTrue(FirstName == "FirstName"); Assert.IsTrue(MiddleName == "MiddleName"); Assert.IsTrue(LastName == "LastName"); Assert.IsTrue(AddSpec == "(JetBrains)"); }
// Start is called before the first frame update void Start() { if (mIntegrator == null) { mIntegrator = GetComponent <Integrator>(); } if (mForceManager == null) { mForceManager = GetComponent <ForceManager>(); } if (mParticleManager == null) { mParticleManager = GetComponent <Particle2DManager>(); } mCurrentWeaponType = WeaponType.SPRING; mContacts = new List <Particle2DContact>(); mContacts.Clear(); mParticleLinks = new List <Particle2DLink>(); mParticleLinks.Clear(); mResolver = gameObject.AddComponent <ContactResolver>(); }