本文整理汇总了C#中Gear类的典型用法代码示例。如果您正苦于以下问题:C# Gear类的具体用法?C# Gear怎么用?C# Gear使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gear类属于命名空间,在下文中一共展示了Gear类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertGearToRawPosition
private int ConvertGearToRawPosition(Gear gear)
{
switch (gear)
{
case Gear.parking:
return 0;
break;
case Gear.reverse:
return 1;
break;
case Gear.neutral:
return 2;
break;
case Gear.drive:
return 3;
break;
case Gear.two:
return 4;
break;
default:
throw new ApplicationException("Unhandled gear!");
break;
}
}
示例2: Gearbox
// Constructor accepts mediator as an argument
public Gearbox(EngineManagementSystem mediator)
{
this.mediator = mediator;
enabled = false;
currentGear = Gear.Neutral;
mediator.RegisterGearbox(this);
}
示例3: setGear
//TODO: make some enum
/// <summary>
///
/// </summary>
/// <param name="gear">
/// p - parking
/// r - reverse
/// n - neutral
/// d - tylko 1 bieg
/// </param>
public void setGear(Gear gear)
{
switch(gear)
{
case Gear.parking:
setTarget(GEARBOX_CHANNEL, GEAR_P);
break;
case Gear.reverse:
setTarget(GEARBOX_CHANNEL, GEAR_R);
break;
case Gear.neutral:
setTarget(GEARBOX_CHANNEL, GEAR_N);
break;
case Gear.drive:
setTarget(GEARBOX_CHANNEL, GEAR_D);
break;
default:
Logger.Log(this, String.Format("trying to set not-existing gear", gear), 2);
break;
}
}
示例4: ParameterAttribute
/// <summary>
///
/// </summary>
/// <param name="gear"></param>
/// <param name="attribute"></param>
public ParameterAttribute(Gear gear, String attribute)
{
_gear = gear;
_attribute = attribute;
//If we have FixedValues use that
//I wan't to create array with rating as index for future, but
//this is keept for backwards/laziness
if (_attribute.StartsWith("FixedValues"))
{
//Regex to extracxt anything between ( ) in Param
Match m = FixedExtract.Match(_attribute);
String vals = m.Groups[1].Value;
//Regex to extract anything inbetween [ ]
//Not sure why i don't just split by , and remove it durring
//next phase
MatchCollection m2 = Regex.Matches(vals, @"\[([^\]]*)\]");
double junk; //Not used, tryparse needs out
//LINQ magic to cast matchcollection to the double[]
fixedDoubles = (from val in m2.Cast<Match>()
where double.TryParse(val.Groups[1].Value, out junk)
select double.Parse(val.Groups[1].Value)).ToArray();
}
else
{
}
}
示例5: GearSet
public GearSet(PictureBox gearBox, PictureBox doorBox)
{
this.door = new Door();
this.gear = new Gear();
this.gearSetState = 0;
this.gearBox = gearBox;
this.doorBox = doorBox;
}
示例6: Update
public void Update(Gear gear, string externalUserId)
{
var oldGear = _gearRepository.ById(gear.Id);
_gearRepository.Update(gear);
Task.Run(() => HandleGearUpdated(gear, oldGear, externalUserId));
}
示例7: Create
public void Create(Gear gear, string externalUserId)
{
gear.Id = gear.Id == Guid.Empty ? Guid.NewGuid() : gear.Id;
_gearRepository.Create(gear);
Task.Run(() => HandleGearCreated(gear, externalUserId));
}
示例8: Pose
public Pose(Vector2 position, float orientation, float wheelAngle, Gear gear)
{
Position = position;
while (orientation < 0f) orientation += MathHelper.TwoPi;
while (orientation >= MathHelper.TwoPi) orientation -= MathHelper.TwoPi;
Orientation = orientation;
WheelAngle = wheelAngle;
Gear = gear;
}
示例9: openTest
public void openTest()
{
GearController gc = new GearController();
gc.ShouldDeploy = true;
Gear gear = new Gear(gc);
gear.Deploy();
System.Threading.Thread.Sleep(15000);
Assert.AreEqual(GearState.LOCKDOWN,gear.GearState);
}
示例10: closeTest
public void closeTest()
{
GearController gc = new GearController();
gc.ShouldDeploy = true;
Gear gear = new Gear(gc);
gear.Retract();
System.Threading.Thread.Sleep(15000);
Assert.AreEqual(GearState.LOCKUP, gear.GearState);
}
示例11: frmSelectNexus
public frmSelectNexus(Character objCharacter, bool blnCareer = false)
{
InitializeComponent();
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
_objCharacter = objCharacter;
_objGear = new Gear(objCharacter);
chkFreeItem.Visible = blnCareer;
MoveControls();
}
示例12: OnTriggerStay2D
public void OnTriggerStay2D(Collider2D coll)
{
Gear gear = coll.GetComponent<Gear>();
if (gear!=null && gear.isMovable && !isActive && (Vector3.Distance(transform.position, gear.transform.position)<minDistanceToTrigger || minDistanceToTrigger==0)) {
print("moving now");
gear.isMovable = false;
gear.Start();
this.gear = gear;
startPos = gear.transform.position;
isActive = true;
}
}
示例13: GearController
public GearController()
{
frontGear = new Gear(this);
frontGearObserver.Subscribe(frontGear);
frontGearObserver.Controller = this;
rightGear = new Gear(this);
rightGearObserver.Subscribe(rightGear);
rightGearObserver.Controller = this;
leftGear = new Gear(this);
leftGearObserver.Subscribe(leftGear);
leftGearObserver.Controller = this;
}
示例14: PlayerSelectionScreen
/// <summary>
/// Creates a new PlayerSelectionScreen object.
/// </summary>
public PlayerSelectionScreen(Gear gear)
{
// check the parameter
if (gear == null)
{
throw new ArgumentNullException("gear");
}
this.IsPopup = true;
this.usedGear = gear;
isGearUsed = false;
drawMaximum = 3;
selectedPlayers = new List<int>();
ResetValues();
Reset();
}
示例15: BuildGearTree
/// <summary>
/// Build up the Tree for the current piece of Gear and all of its children.
/// </summary>
/// <param name="objGear">Gear to iterate through.</param>
/// <param name="objNode">TreeNode to append to.</param>
/// <param name="objMenu">ContextMenuStrip that the new TreeNodes should use.</param>
public void BuildGearTree(Gear objGear, TreeNode objNode, ContextMenuStrip objMenu)
{
foreach (Gear objChild in objGear.Children)
{
TreeNode objChildNode = new TreeNode();
objChildNode.Text = objChild.DisplayName;
objChildNode.Tag = objChild.InternalId;
objChildNode.ContextMenuStrip = objMenu;
if (objChild.Notes != string.Empty)
objChildNode.ForeColor = Color.SaddleBrown;
objChildNode.ToolTipText = objChild.Notes;
objNode.Nodes.Add(objChildNode);
objNode.Expand();
// Set the Gear's Parent.
objChild.Parent = objGear;
BuildGearTree(objChild, objChildNode, objMenu);
}
}