本文整理汇总了C#中PhysicsObject.Push方法的典型用法代码示例。如果您正苦于以下问题:C# PhysicsObject.Push方法的具体用法?C# PhysicsObject.Push怎么用?C# PhysicsObject.Push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysicsObject
的用法示例。
在下文中一共展示了PhysicsObject.Push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: movePlayerAnalog
public void movePlayerAnalog(AnalogState al, PhysicsObject player)
{
double xPos = al.StateVector.X;
double yPos = al.StateVector.Y;
Vector pPushVector = new Vector((xPos) * PLAYER_SPEED_X.X, (yPos) * PLAYER_SPEED_Y.Y);
player.Push(pPushVector);
double maxVibration = 0.15;
double maxBias = 0.5;
double prcBias = (0.5 * Math.Abs((xPos + yPos / 2))) +
(0.5 * Math.Max(0, Math.Min(1, (1 - Math.Abs((player.Velocity.Magnitude / 100))))));
//Bias the control
double rightControllerVibr = ((maxVibration / 2) - ((maxVibration / 2 * maxBias) * xPos)) * prcBias;
double leftControllerVibr = ((maxVibration / 2) + ((maxVibration / 2 * maxBias) * xPos)) * prcBias;
if (((ControllerOne.GetType()) == typeof(GamePad)) && vibrateEnabled)
{
GamePad gp = ControllerOne as GamePad;
gp.Vibrate(leftControllerVibr, rightControllerVibr, 0, 0, 0.1);
}
//player.Velocity = pPushVector;
}
示例2: MovePlayer
/// <summary>
/// Applies the force vector specified in the controls to the player object.
/// </summary>
/// <param name="force">The force vector to be applied, specified in a previous Listen method</param>
/// <param name="player">The player that the force vector is to be applied to, specified in a previous Listen method</param>
public void MovePlayer(Vector force, PhysicsObject player)
{
player.Push(force);
//player.Velocity = force;
}