public bool TrainLine(ETransitionType transitionType, int thickness, int threshold, int minAmplitude, int minArea, float samplingStep) { bool reSuccess = false; try { reSuccess = TrainLine( transitionType, thickness, ETransitionChoice.LargestAmplitude, Measurement_TransitionIndex, Measurement_Smoothing, threshold, minAmplitude, minArea, Measurement_HVConstraint, Measurement_RectangularSamplingArea, samplingStep, Fitting_KnownAngle, Fitting_FilteringThreshold, Fitting_NumFilteringPasses); } catch (EException exc) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true); } catch (Exception ex) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true); } return(reSuccess); }
private bool TrainLine( ETransitionType transitionType, int thickness, ETransitionChoice transitionChoice, int transitionIndex, int smoothing, int threshold, int minAmplitude, int minArea, bool HVConstraint, bool rectangularSamplingArea, float samplingStep, bool knownAngle, float filteringThreshold, int numFilteringPasses) { bool reSuccess = false; try { thickness = thickness < 1 ? 1 : thickness; threshold = threshold < 0 ? 0 : threshold; threshold = threshold > 255 ? 255 : threshold; minAmplitude = minAmplitude < 0 ? 0 : minAmplitude; minAmplitude = minAmplitude > 255 ? 255 : minAmplitude; minArea = minArea < 0 ? 0 : minArea; Base.TransitionType = transitionType; Base.Thickness = (int)thickness; Base.TransitionChoice = transitionChoice; Base.TransitionIndex = (int)transitionIndex; Base.Smoothing = (int)smoothing; Base.Threshold = (int)threshold; Base.MinAmplitude = (int)minAmplitude; Base.MinArea = (int)minArea; Base.HVConstraint = HVConstraint; Base.RectangularSamplingArea = rectangularSamplingArea; Base.SamplingStep = samplingStep; Base.KnownAngle = knownAngle; Base.FilteringThreshold = filteringThreshold; Base.NumFilteringPasses = (int)numFilteringPasses; reSuccess = true; } catch (EException exc) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true); } catch (Exception ex) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true); } return(reSuccess); }
public override void PlacePlayer(Player player, ETransitionType transitionType = ETransitionType.Walk) { if (player == null) { return; } var animator = player.GetComponent <PlayerTransition>(); var underneathTile = player.attachedTile.LowestTileFromUnderneath; var destinationTile = GetTileFromOppositeDirection(underneathTile); if (animator) { animator.DirectTransition(PositionForPlayer); } if (destinationTile == null) { player.Die(); return; } destinationTile = destinationTile.HighestTileFromAbove; if ((destinationTile.TileData.IsWalkable || destinationTile.TileData.TileType == ETileType.Void) && !destinationTile.IsPlayerOnTile) { destinationTile.PlacePlayer(player); } else { base.PlacePlayer(player); } }
public ETransitionType GetSensorTransition(int newSensorVal) { if (SensorHigh) { if (newSensorVal < _sensorLowLimit) // change state { SensorHigh = false; ChangeTime = DateTime.Now; LastTransition = ETransitionType.DescendEdge; return(LastTransition); } else { return(ETransitionType.HighLevel); } } else { // check rising Edge if (newSensorVal > _sensorHighLimit) // change state { SensorHigh = true; ChangeTime = DateTime.Now; LastTransition = ETransitionType.RisingEdge; return(LastTransition); } else { return(ETransitionType.LowLevel); } } }
public override void PlacePlayer(Player player, ETransitionType transitionType = ETransitionType.Walk) { if (player == null) { return; } var particlesRef = GetComponent <ParticleSystem>(); var path = GetPathOfTilesToTheOppositeTileWithGap(player.attachedTile, 3); Tile destinationTile = this; if (path.Count < 3) { particlesRef.Play(); player.Die(); return; } //Gets last walkable tile from the path if (path.Count > 0) { for (var i = path.Count - 1; i > -1; i--) { var tileOnPath = path[i].HighestTileFromAbove; if ((tileOnPath.TileData.IsWalkable || tileOnPath.TileData.TileType == ETileType.Void) && !tileOnPath.IsPlayerOnTile) { destinationTile = tileOnPath; break; } } } else { particlesRef.Play(); player.Die(); return; } if (destinationTile == this) { base.PlacePlayer(player); return; } var animator = player.GetComponent <PlayerTransition>(); if (animator != null) { animator.DirectTransition(destinationTile.PositionForPlayer); } particlesRef.Play(); destinationTile.PlacePlayer(player); }
private void TrainSetting_ValueChanged(object sender, EventArgs e) { ETransitionType transitionType = (ETransitionType)Enum.Parse(typeof(ETransitionType), cboTransitionType.Text, true); int thickness = Convert.ToInt32(nudThickness.Value); float samplingStep = Convert.ToSingle(nudSamplingStep.Value); int threshold = Convert.ToInt32(nudThreshold.Value); int minAmplitude = Convert.ToInt32(nudMinAmplitude.Value); int minArea = Convert.ToInt32(nudMinArea.Value); eFindLine.TrainLine(transitionType, thickness, threshold, minAmplitude, minArea, samplingStep); eFindLine.FindLine(); eFindLine.GetSample(); eFindLine.ShowROI(); }
public void LoadScene(string sceneName, ETransitionType type = ETransitionType.None, OnBeforeSceneLoadCallback onBeforeSceneLoadCallback = null) { sceneToLoad = sceneName; beforeSceneLoadCallback = onBeforeSceneLoadCallback; transitionsObject.SetActive(true); TransitionType = type; TransitionPhase = ETransitionPhase.Out; if (TransitionType == ETransitionType.None) { OnOutComplete(); OnInComplete(); } }