public void SetPhase(ElementPhase newPhase) { if (newPhase == ElementPhase.Solid) { maxVelocity = 0; if (phase == ElementPhase.Liquid && psMovementType == MovementType.Stop) { solidStopParticle = new ParticleSystem.Particle[ps.main.maxParticles]; solidStopParticleCount = ps.GetParticles(solidStopParticle); initialSolidPosition = transform.position; rb.bodyType = RigidbodyType2D.Kinematic; } } else if (newPhase == ElementPhase.Liquid) { solidStopParticle = null; rb.bodyType = RigidbodyType2D.Kinematic; } phase = newPhase; }
public void SetFluidState(ElementPhase ep) { fluidState.value = (int)ep; fluidState.RefreshShownValue(); }
private void AddElement(object element, string elementName, int phase) { object existing; Dictionary<string, object> nameMappingDictionary = myNameMappingDictionary; if (nameMappingDictionary.TryGetValue(elementName, out existing)) { // Note: We use LinkedListNode here directly instead of a LinkedList // to facilitate dynamically adding/removing elements during iteration LinkedNode<ElementPhase> node = existing as LinkedNode<ElementPhase>; if (node == null) { // Record the unresolvedName if (myUnresolvedNames == null) { myUnresolvedNames = new Dictionary<string, string>(); } myUnresolvedNames[elementName] = elementName; // Create a node for the original element node = new LinkedNode<ElementPhase>((ElementPhase)existing); } LinkedNode<ElementPhase> newNode = new LinkedNode<ElementPhase>(new ElementPhase(element, phase)); newNode.SetNext(node, ref node); nameMappingDictionary[elementName] = newNode; } else { nameMappingDictionary[elementName] = new ElementPhase(element, phase); } }