public Boss(IMotion motion, BossGun topGun, BossGun middleGun, BossGun bottomGun) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[] { level.LoadImage("images/shooter/boss/boss.png", false) }, 0, 133); sequence.Delay = 200; sequence.Loop = true; AnimationSequences[DefaultAnimation] = sequence; _topGun = topGun; _middleGun = middleGun; _bottomGun = bottomGun; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[] { level.LoadImage("images/shooter/boss/boss.png", false) }, 0, 133); sequence.Delay = 500; sequence.Loop = true; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 300; }
public Boss(IMotion motion, BossGun topGun, BossGun middleGun, BossGun bottomGun) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/boss/boss.png", false) }, 0, 133); sequence.Delay = 200; sequence.Loop = true; AnimationSequences[DefaultAnimation] = sequence; _topGun = topGun; _middleGun = middleGun; _bottomGun = bottomGun; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/boss/boss.png", false) }, 0, 133); sequence.Delay = 500; sequence.Loop = true; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 300; }
/// <summary> /// функция для записи в textbox /// </summary> /// <param name="motion"></param> public void SetMotion(IMotion motion) { var FOrm = new Model(); if (motion is AcceleratedMotion) { _RadioButtonAscillatoryMotion.Checked = true; var Ax = (AcceleratedMotion)(motion); _TextboxAcellerationMotion_AX0.Text = Convert.ToString(Ax.AX); _TextboxAcellerationMotion_V0.Text = Convert.ToString(Ax.V0X); _TextboxAcellerationMotion_X0.Text = Convert.ToString(Ax.X0); _TextboxAcellerationMotion_Time.Text = Convert.ToString(Ax.Time); } if (motion is UniformlyAcceleratedMotion) { _RadioButtonUnidormMotion.Checked = true; var Ux = (UniformlyAcceleratedMotion)(motion); _TextboxUniformMotion_X0.Text = Convert.ToString(Ux.X0); _TextboxUniformMotion_V0.Text = Convert.ToString(Ux.VX); _TextboxUniformMotion_Time.Text = Convert.ToString(Ux.Time); } if (motion is OscillatoryMotion) { _RadioButtonOcillatoryMotion.Checked = true; var Ox = (OscillatoryMotion)(motion); _TextboxOscillatoryMotion_F0.Text = Convert.ToString(Ox.F0); _TextboxOscillatoryMotion_W0.Text = Convert.ToString(Ox.W0); _TextboxOscillatoryMotion_X0.Text = Convert.ToString(Ox.X0); _TextboxOscillatoryMotion_VX0.Text = Convert.ToString(Ox.XM); _TextboxOscillatoryMotion_Time.Text = Convert.ToString(Ox.Time); } }
private void button_add_ok_Click(object sender, EventArgs e) { try { m_listAxisPosValue.Clear(); IMotion imotion = MotionBase.GetInstanceInterface(); if (imotion != null) { for (int i = 0; i < imotion.GetAxisCount(); i++) { TextBox textbox = (TextBox)flowLayoutPanel1.Controls.Find("textBox_" + i, true)[0]; m_listAxisPosValue.Add(textbox.Text); } DialogResult = System.Windows.Forms.DialogResult.OK; } Close(); } catch (Exception E) { LogFile.LogExceptionErr(E.ToString()); MessageBox.Show(E.Message); } }
/// <summary> /// </summary> /// <param name="motion"></param> public virtual void ApplyMotion(IMotion motion) { #if NEODROID_DEBUG if (this.Debugging) { Debug.Log($"Applying {motion} To {this.name}'s Actuators"); } #endif var motion_actuator_name = motion.ActuatorName; if (this._Actuators.ContainsKey(motion_actuator_name) && this._Actuators[motion_actuator_name] != null) { this._Actuators[motion_actuator_name].ApplyMotion(motion); } else { #if NEODROID_DEBUG if (this.Debugging) { Debug.Log($"Could find not Actuator with the specified name: {motion_actuator_name} on actor {this.name}"); } #endif } }
public void AddMotionCard(string CardName, IMotion MotionCard) { if (!MotionDic.Keys.Contains(CardName)) { MotionDic.Add(CardName, MotionCard); } }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="motion"></param> /// <exception cref="T:System.ArgumentOutOfRangeException"></exception> protected override void InnerApplyMotion(IMotion motion) { var m = motion.Strength; #if NEODROID_DEBUG if (this.Debugging) { Debug.Log(message: $"Inner Applying {m} To {this.name}"); Debug.Log(message: $"Current rotation of {this.name} is {this.transform.rotation}"); } #endif if (motion.ActuatorName == this._x) { this.transform.Rotate(axis: Vector3.forward, angle: m); } else if (motion.ActuatorName == this._z) { this.transform.Rotate(axis: Vector3.right, angle: m); } this.transform.rotation = RotationClamping.ClampRotation(temp_eulers: this.transform.rotation.eulerAngles, low: this.limits.Max.x, high: this.limits.Max.x); }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="motion"></param> /// <exception cref="T:System.ArgumentOutOfRangeException"></exception> protected override void InnerApplyMotion(IMotion motion) { if (this._material) { switch ((int)motion.Strength) { case 1: this._material.color = Color.blue; break; case 2: this._material.color = Color.black; break; case 3: this._material.color = Color.red; break; case 4: this._material.color = Color.green; break; default: throw new ArgumentOutOfRangeException(); } } }
/// <summary> /// Кнопка для создания рандомных значений /// и добавления их в datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RandomButton_Click(object sender, EventArgs e) { var Rundom = new Random(); for (int i = 0; i < 10; i++) { IMotion iMotion = null; const double chislo = 100; switch (Rundom.Next() % 3) { case 0: { iMotion = new AcceleratedMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo), Rundom.NextDouble() * chislo); break; } case 1: { iMotion = new OscillatoryMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo), Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo); break; } case 2: { iMotion = new UniformlyAcceleratedMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo)); break; } } AddMotion(iMotion); } }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="motion"></param> protected override void InnerApplyMotion(IMotion motion) { foreach (var indicator in this._Indicators) { indicator.color = this._inactive_color; } var index = (int)motion.Strength; #if NEODROID_DEBUG if (this.Debugging) { Debug.Log($"MultiArmedBandit got index {index}"); } #endif this._last_index = index; var random_value = Random.Range(0f, 1f); if (random_value < this._Win_Likelihoods[this._last_index]) { this._Indicators[this._last_index].color = this._win_color; this._won = true; } else { this._Indicators[this._last_index].color = this._lose_color; this._won = false; } }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="motion"></param> protected override void InnerApplyMotion(IMotion motion) { if (motion.ActuatorName == this._x) { this.transform.Translate(Vector3.right * motion.Strength, this._Relative_To); } else if (motion.ActuatorName == this._y) { this.transform.Translate(-Vector3.up * motion.Strength, this._Relative_To); } else if (motion.ActuatorName == this._z) { this.transform.Translate(-Vector3.forward * motion.Strength, this._Relative_To); } else if (motion.ActuatorName == this._rot_x) { this.transform.Rotate(Vector3.right, motion.Strength, this._Relative_To); } else if (motion.ActuatorName == this._rot_y) { this.transform.Rotate(Vector3.up, motion.Strength, this._Relative_To); } else if (motion.ActuatorName == this._rot_z) { this.transform.Rotate(Vector3.forward, motion.Strength, this._Relative_To); } }
static void Main(string[] args) { // 协变 Func <string> func1 = () => "KKKK"; Func <object> func2 = func1; // 逆变 Action <object> fun3 = t => { }; Action <string> fun4 = fun3; // 协变 MyFunc <string> str1 = () => "TTTT"; MyFunc <object> str2 = str1; // 逆变 MyFunc2 <object> str3 = t => { }; MyFunc2 <string> str4 = str3; MyFunc3 <object, string> str11 = t => "loud"; MyFunc3 <string, string> str22 = str11; //第一个泛型的逆变(object->string) MyFunc3 <object, object> str33 = str11; //第二个泛型的协变(string->object) MyFunc3 <string, string> str44 = str11; //第一个泛型的逆变和第二个泛型的协变 // 协变 IEnumerable <string> list = new List <string>(); IEnumerable <object> list2 = list; // 逆变 IComparable <object> list3 = null; IComparable <string> list4 = list3; IMotion <Teacher> x = new Run <Teacher>(); IMotion <People> y = x; Console.WriteLine("Hello World!"); }
public MotionManager Motion(IMotion motion) { motion.Init(this); if (currentMotion == null) { currentMotion = motion; currentMotion.Start(); } motion.OnComplete += () => { if (motions.IndexOf(currentMotion) == motions.Count - 1) { Completed = true; if (completed != null) { completed(); } } else { currentMotion = motions[motions.IndexOf(currentMotion) + 1]; currentMotion.Start(); } }; motions.Add(motion); return(this); }
public BigSaucer(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/saucer/0001.png", false), level.LoadImage("images/shooter/saucer/0001.2.png", false), level.LoadImage("images/shooter/saucer/0001.png", false), level.LoadImage("images/shooter/saucer/0001.3.png", false) }, 73, 32); sequence.Delay = 300; sequence.Loop = true; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/saucer/0003.png", false), level.LoadImage("images/shooter/saucer/0004.png", false), level.LoadImage("images/shooter/saucer/0005.png", false), level.LoadImage("images/shooter/saucer/0006.png", false), level.LoadImage("images/shooter/saucer/0007.png", false), level.LoadImage("images/shooter/saucer/0008.png", false), level.LoadImage("images/shooter/saucer/0009.png", false), level.LoadImage("images/shooter/saucer/0010.png", false) }, 150, 62); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 16; }
public BigSaucer(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[] { level.LoadImage("images/shooter/saucer/0001.png", false), level.LoadImage("images/shooter/saucer/0001.2.png", false), level.LoadImage("images/shooter/saucer/0001.png", false), level.LoadImage("images/shooter/saucer/0001.3.png", false) }, 73, 32); sequence.Delay = 300; sequence.Loop = true; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[] { level.LoadImage("images/shooter/saucer/0003.png", false), level.LoadImage("images/shooter/saucer/0004.png", false), level.LoadImage("images/shooter/saucer/0005.png", false), level.LoadImage("images/shooter/saucer/0006.png", false), level.LoadImage("images/shooter/saucer/0007.png", false), level.LoadImage("images/shooter/saucer/0008.png", false), level.LoadImage("images/shooter/saucer/0009.png", false), level.LoadImage("images/shooter/saucer/0010.png", false) }, 150, 62); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 16; }
public PlasmaBall(Vector2D location, IMotion motion) : base() { Location = new Vector3D(location.X, location.Y, ShooterLevel.WeaponsZ); Motion = motion; ShooterLevel.Current.Plasma.AddPlasmaBall(this); }
public static MotionManager StartMotion(int positionX, int positionY, IMotion motion) { var mm = new MotionManager(positionX, positionY); mm.Motion(motion); return(mm); }
private void Value_OnErrorOccured(IMotion sender, int ErrorCode, string ErrorMsg) { //过滤掉因为ADC引发的停止 if (ErrorCode != 0x83 && ErrorCode != 0x84) { Messenger.Default.Send <string>($"Motion{sender.motionCfg.Name} error occured:{ErrorMsg}", "Error"); } }
public MoveToPoint(StateInfo info, Vector2 destination, BaseUnitState nextState) : base(info) { rb = info.unit.GetComponent <Rigidbody2D>(); motion = info.unit.GetComponent <IMotion>(); _nextState = nextState; this.destination = destination; }
public void UpdatePosition(int increment) { IMotion motion = SelectMotion(increment); motion.BeforeUpdate(increment); this.currentPosition += increment; motion.AfterUpdate(increment); }
public bool IntersectsPoint(Vector worldPosition, ulong time) { IMotion motion = m_Path.GetCurrentMotion(time); var objectPosition = motion.GetCurrentPosition(time); return(m_Bounds.Contains(worldPosition, objectPosition)); }
public Path(double maximumAcceleration, IMotion startingMotion) { m_Acceleration = maximumAcceleration; m_Motion = new CombinedMotion(new List <IMotion> { startingMotion }); }
public Path(double maximumAcceleration, IMotion startingMotion) { m_Acceleration = maximumAcceleration; m_Motion = new CombinedMotion(new List<IMotion> { startingMotion }); }
public void BecauseOf() { m_Path = Get<IPath>(); m_Motion = Get<IMotion>(); m_Path.GetCurrentMotion(Arg.Any<ulong>()).Returns(m_Motion); m_SelectableObject = new SelectableObject(m_TestObjectName, m_Path); }
public void BecauseOf() { m_Path = Get <IPath>(); m_Motion = Get <IMotion>(); m_Path.GetCurrentMotion(Arg.Any <ulong>()).Returns(m_Motion); m_SelectableObject = new SelectableObject(m_TestObjectName, m_Path); }
public Bullet(Vector2D location, int strength, IMotion motion) : base(location, motion) { AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(ShooterLevel.Current.LoadImage((strength == 1)? "images/shooter/meteor/sb.png" : "images/shooter/meteor/b.png", false), 0, 0); AnimationSequences["Default"] = sequence; StartAnimation("Default"); _strength = strength; }
public void Dispose() { AllEventsHandler.Instance.Motion -= OnMotionPositionMeasured; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged -= OnTimeTraceMeasurementsStateChanged; this._Motor = null; this._Destination = 0.0; this._MeasureDevice = null; this._ValueThroughTheStructure = 0.0; }
public Path(double maximumAcceleration, IMotion startingMotion, IBus bus) { m_Bus = bus; m_Disposer = new Disposer(); m_Bus.Subscribe<SetPathToTarget>(OnSetPathToTarget).AddTo(m_Disposer); m_Acceleration = maximumAcceleration; m_Path = new List<IMotion>(); m_Path.Add(startingMotion); }
public Path(double maximumAcceleration, IMotion startingMotion, IBus bus) { m_Bus = bus; m_Disposer = new Disposer(); m_Bus.Subscribe <SetPathToTarget>(OnSetPathToTarget).AddTo(m_Disposer); m_Acceleration = maximumAcceleration; m_Path = new List <IMotion>(); m_Path.Add(startingMotion); }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="motion"></param> protected override void InnerApplyMotion(IMotion motion) { if (motion.ActuatorName == this._movement) { this.ApplyMovement(motion.Strength); } else if (motion.ActuatorName == this._turn) { this.ApplyRotation(motion.Strength); } }
/// <summary> /// /// </summary> /// <param name="motion"></param> /// <exception cref="ArgumentOutOfRangeException"></exception> protected override void InnerApplyMotion(IMotion motion) { var ind = (Int32)motion.Strength; if (ind >= this._events.Length) { return; } this._events[ind].Invoke(); }
public void Restart() { CurrentPosition = new PointF(positionX, positionY); foreach (var motion in motions) { motion.Init(this); } Completed = false; currentMotion = motions[0]; currentMotion.Start(); }
/// <summary> /// Функция которая открывает форму и вписывает /// изменёные значения в datgrid /// </summary> /// <param name="motion"></param> /// <param name="rowIndex"></param> private void EditMotion(IMotion motion, int rowIndex) { _motions[rowIndex] = motion; var row = new DataGridViewRow(); row.CreateCells(_dataGridView); var motionType = motion.Name; var motionCalc = motion.CalculateCoordination().ToString("F"); _dataGridView.Rows[rowIndex].Cells[0].Value = motionType; _dataGridView.Rows[rowIndex].Cells[1].Value = motionCalc; }
static IMotion[] deserialise_motions(FReaction reaction) { var l = reaction.MotionsLength; var motions = new IMotion[l]; for (var i = 0; i < l; i++) { motions[i] = deserialise_motion(reaction.Motions(i)); } return(motions); }
/// <summary> /// </summary> /// <param name="motion"></param> public void ApplyMotion(IMotion motion) { #if NEODROID_DEBUG if (this.Debugging) { Debug.Log("Applying " + motion + " To " + this.name); } #endif motion.Strength = this._motion_value_space._space.Reproject(motion.Strength); this.InnerApplyMotion(motion); }
public MeasureTimeTrace(IMotion motor, double startPosition, double destination, I_SMU measureDevice, KEITHLEY_2601A_SourceMode sourceMode, KEITHLEY_2601A_MeasureMode measureMode, double valueThroughTheStructure) { _Motor = motor; _StartPosition = startPosition; _Destination = destination; _MeasureDevice = measureDevice; _SourceMode = sourceMode; _MeasureMode = measureMode; _ValueThroughTheStructure = valueThroughTheStructure; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged += OnTimeTraceMeasurementsStateChanged; AllEventsHandler.Instance.Motion += OnMotionPositionMeasured; }
public BasicPlasmaBall(Vector2D location, IMotion motion) : base(location, motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/plasma/1.png", false), level.LoadImage("images/shooter/plasma/2.png", false), level.LoadImage("images/shooter/plasma/3.png", false), level.LoadImage("images/shooter/plasma/2.png", false) }, 6, 6); sequence.Loop = true; sequence.Delay = 200; AnimationSequences["Default"] = sequence; StartAnimation("Default"); }
public Pteranodon(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/ptera/0001.png", false), level.LoadImage("images/shooter/ptera/0002.5.png", false), level.LoadImage("images/shooter/ptera/0002.png", false), level.LoadImage("images/shooter/ptera/0002.5.png", false), level.LoadImage("images/shooter/ptera/0001.png", false), level.LoadImage("images/shooter/ptera/0003.5.png", false), level.LoadImage("images/shooter/ptera/0003.png", false), level.LoadImage("images/shooter/ptera/0003.5.png", false) }, 0, 0); sequence.Delay = 200; sequence.Loop = true; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/ptera/0005.png", false), level.LoadImage("images/shooter/ptera/0006.png", false), level.LoadImage("images/shooter/ptera/0007.png", false), level.LoadImage("images/shooter/ptera/0008.png", false), level.LoadImage("images/shooter/ptera/0009.png", false), level.LoadImage("images/shooter/ptera/0010.png", false), level.LoadImage("images/shooter/ptera/0011.png", false), level.LoadImage("images/shooter/ptera/0012.png", false), level.LoadImage("images/shooter/ptera/0013.png", false), level.LoadImage("images/shooter/ptera/0014.png", false), level.LoadImage("images/shooter/ptera/0015.png", false) }, 0, 0); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 4; }
public BossGun(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun1.png", false), 79, 45); sequence.Delay = 0; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun2.png", false), 79, 1); sequence.Delay = 0; AnimationSequences["Gun2"] = sequence; sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun3.png", false), 100, 21); sequence.Delay = 0; AnimationSequences["Gun3"] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/boss/0001.png", false), level.LoadImage("images/shooter/boss/0002.png", false), level.LoadImage("images/shooter/boss/0003.png", false), level.LoadImage("images/shooter/boss/0004.png", false), level.LoadImage("images/shooter/boss/0005.png", false), level.LoadImage("images/shooter/boss/0006.png", false), level.LoadImage("images/shooter/boss/0007.png", false), level.LoadImage("images/shooter/boss/0008.png", false), level.LoadImage("images/shooter/boss/0009.png", false), }, 50, 50); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 150; }
public Gun(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/gun/0000.png", false), level.LoadImage("images/shooter/gun/0001.png", false), level.LoadImage("images/shooter/gun/0002.png", false), level.LoadImage("images/shooter/gun/0003.png", false), level.LoadImage("images/shooter/gun/0004.png", false), level.LoadImage("images/shooter/gun/0005.png", false), level.LoadImage("images/shooter/gun/0006.png", false), level.LoadImage("images/shooter/gun/0007.png", false), level.LoadImage("images/shooter/gun/0008.png", false) }, 52, 73); sequence.Delay = 0; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[]{ level.LoadImage("images/shooter/gun/e0003.png", false), level.LoadImage("images/shooter/gun/e0004.png", false), level.LoadImage("images/shooter/gun/e0005.png", false), level.LoadImage("images/shooter/gun/e0006.png", false), level.LoadImage("images/shooter/gun/e0007.png", false), level.LoadImage("images/shooter/gun/e0008.png", false), level.LoadImage("images/shooter/gun/e0009.png", false), level.LoadImage("images/shooter/gun/e0010.png", false) }, 60, 73); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 8; }
public Dino(IMotion motion) { Motion = motion; }
public bool SameVersion(IMotion motion) { return motion.GetType() == GetType() && motion.VersionCode == VersionCode; }
public void setMotion(IMotion x) { motion = x; }
private bool InitTimeTraceMeasurements() { #region SMU, rendering and save data configurations if (sourceDeviceConfiguration != null) { #region Chart rendering settings if (_TimeTraceLineGraph != null) { _experimentalTimeTraceDataSource.DetachPointReceiveEvent(); _TimeTraceLineGraph.Remove(); _CurrentTimeTrace.Clear(); } _CurrentTimeTrace = new List<PointD>(); _experimentalTimeTraceDataSource = new ExperimentalTimetraceDataSource(_CurrentTimeTrace); _experimentalTimeTraceDataSource.AttachPointReceiveEvent(); _TimeTraceLineGraph = new LineGraph(_experimentalTimeTraceDataSource); _TimeTraceLineGraph.AddToPlotter(chartTimeTrace); #endregion //Getting SMU device Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device; #region Time trace measurement configuration var pAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.PrimaryAddress; var sAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.SecondaryAddress; var bNumber = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.BoardNumber; var motor = new ORDINARY_MOTOR(pAddress, sAddress, bNumber); motor.FinalDestination = 0.0; Motor = motor; if (TimeTraceCurve != null) { TimeTraceCurve.Dispose(); } var ExperimentSettings = IV_And_TimeTraceViewModel.Instance; var valueThroughTheStructure = ExperimentSettings.TimeTraceMeasurementValueThrougtTheStructure; var isTimeTraceVoltageModeChecked = ExperimentSettings.IsTimeTraceMeasurementVoltageModeChecked; var isTimeTraceCurrentModeChecked = ExperimentSettings.IsTimeTraceMeasurementCurrentModeChecked; var selectedTimeTraceModeItem = (tabControlTimeTraceMeasurementParameters.SelectedItem as TabItem).Header.ToString(); switch (selectedTimeTraceModeItem) { case "Distance": { var motionStartPosition = ExperimentSettings.TimeTraceMeasurementMotionCurrentDestination; var motionFinalDestination = ExperimentSettings.TimeTraceMeasurementMotionFinalDestination; if (isTimeTraceVoltageModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); else if (isTimeTraceCurrentModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } break; case "Distance (Repetitive)": { var motionRepetitiveStartPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveStartPosition; var motionRepetitiveEndPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveEndPosition; var numerCycles = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveNumberCycles; if (isTimeTraceVoltageModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); else if (isTimeTraceCurrentModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } break; case "Time": { } break; case "Fixed R": { } break; default: break; } #endregion #region Saving Time Trace data into files var _TimeTraceFileNumber = String.Format("_{0}{1}{2}", (_TimeTraceFilesCounter / 100) % 10, (_TimeTraceFilesCounter / 10) % 10, _TimeTraceFilesCounter % 10); string newFileName = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { _TimeTraceMeasurementLog = new TimeTraceMeasurementLog((new FileInfo(_SaveTimeTraceMeasuremrentFileName)).DirectoryName + "\\TimeTraceMeasurementLog.dat"); newFileName = _SaveTimeTraceMeasuremrentFileName.Insert(_SaveTimeTraceMeasuremrentFileName.LastIndexOf('.'), _TimeTraceFileNumber); ++_TimeTraceFilesCounter; } string sourceMode = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { string fileName = (new FileInfo(newFileName)).Name; if (this.radioTimeTraceSourceVoltage.IsChecked == true) { sourceMode = "Source mode: Voltage"; } else if (this.radioTimeTraceSourceCurrent.IsChecked == true) { sourceMode = "SourceMode: Current"; } double micrometricBoltPosition = double.NaN; double.TryParse(this.textBoxTimeTraceMicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition); string comment = this.textBoxTimeTraceComment.Text; _TimeTraceMeasurementLog.AddNewTimeTraceMeasurementLog(fileName, sourceMode, valueThroughTheStructure, comment); } SourceMode _sourceMode = SourceMode.Voltage; //Source mode is voltage by default if (sourceMode == "Source mode: Voltage") _sourceMode = SourceMode.Voltage; else if (sourceMode == "SourceMode: Current") _sourceMode = SourceMode.Current; if (_TimeTraceSingleMeasurement != null) _TimeTraceSingleMeasurement.Dispose(); _TimeTraceSingleMeasurement = new TimeTraceSingleMeasurement(newFileName, _sourceMode); #endregion return true; } else { return false; } #endregion }
public Projectile(Vector2D location, IMotion motion) : base() { Location = new Vector3D(location.X, location.Y, ShooterLevel.WeaponsZ); Motion = motion; }