void CreateSavedSolenoidData(SavedSolenoidData solenoidData, PneumaticSolenoid solenoid) { solenoidData.configured = false; solenoidData.solenoidTargetId = 0; if ((solenoid as IConfigurable).IsConfigured()) { solenoidData.configured = true; solenoidData.solenoidTargetId = solenoid.correlationTarget.gameObject.GetInstanceID(); } }
void LateUpdate() { if (simulating) { PneumaticSolenoid leftSolenoid = componentReferences.solenoidList[0]; PneumaticSolenoid rightSolenoid = componentReferences.solenoidList[1]; if (leftSolenoid.active && !rightSolenoid.active) { if (state != ValveState.left) { state = ValveState.left; for (int i = 0; i < componentsToAnimate.Length; ++i) { componentsToAnimate[i].position = originalPositions[i] + transform.right * shiftAmount; } } } else if (!leftSolenoid.active && rightSolenoid.active) { if (state != ValveState.right) { state = ValveState.right; for (int i = 0; i < componentsToAnimate.Length; ++i) { componentsToAnimate[i].position = originalPositions[i] - transform.right * shiftAmount; } } } else if (state != ValveState.middle) { state = ValveState.middle; for (int i = 0; i < componentsToAnimate.Length; ++i) { componentsToAnimate[i].position = originalPositions[i]; } } } }
public void AddPneumaticSolenoid(PneumaticSolenoid solenoid) { solenoidList.Add(solenoid); }