当前位置: 首页>>代码示例>>C#>>正文


C# PhysicsObject.Push方法代码示例

本文整理汇总了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;
    }
开发者ID:JakezuGD,项目名称:RampageRebellion,代码行数:25,代码来源:RRBegin.cs

示例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;
 }
开发者ID:JakezuGD,项目名称:RampageRebellion,代码行数:10,代码来源:RRBegin.cs


注:本文中的PhysicsObject.Push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。