本文整理汇总了C#中FrameEvent类的典型用法代码示例。如果您正苦于以下问题:C# FrameEvent类的具体用法?C# FrameEvent怎么用?C# FrameEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrameEvent类属于命名空间,在下文中一共展示了FrameEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExampleApp_FrameStarted
protected override bool ExampleApp_FrameStarted(FrameEvent evt)
{
if(base.ExampleApp_FrameStarted(evt) == false )
return false;
if( inputKeyboard.IsKeyDown( MOIS.KeyCode.KC_N ) )
{
pThrusters.SetDefaultDimensions( fDefDim + 0.25f, fDefDim + 0.25f );
fDefDim += 0.25f;
}
if( inputKeyboard.IsKeyDown( MOIS.KeyCode.KC_M ) )
{
pThrusters.SetDefaultDimensions( fDefDim - 0.25f, fDefDim - 0.25f );
fDefDim -= 0.25f;
}
if( inputKeyboard.IsKeyDown( MOIS.KeyCode.KC_H ) )
{
pThrusters.GetEmitter( 0 ).ParticleVelocity = fDefVel + 1;
pThrusters.GetEmitter( 1 ).ParticleVelocity = fDefVel + 1;
fDefVel += 1;
}
if( inputKeyboard.IsKeyDown( MOIS.KeyCode.KC_J ) && !( fDefVel < 0.0f ) )
{
pThrusters.GetEmitter( 0 ).ParticleVelocity = fDefVel - 1;
pThrusters.GetEmitter( 1 ).ParticleVelocity = fDefVel - 1;
fDefVel -= 1;
}
return true;
}
示例2: PreSimulate
/// <summary>
/// We can't use constraints because otherwise we wouldn't be able to do loops.
/// </summary>
void PreSimulate(DiscreteDynamicsWorld world, FrameEvent evt)
{
// if the kart's gone, then we can get rid of this handler too
if (kart == null || kart.Vehicle.IsDisposed) {
Detach();
return;
}
// don't self-right if we're paused
else if (Pauser.IsPaused)
return;
// so first we get the kart's orientation
// then we basically get its local Y axis and average it with the global Y axis to make more of a smooth transition
Vector3 locY = kart.ActualOrientation.YAxis;
// first of all, if we're self righted enough, we can get rid of this handler
if (locY.DirectionEquals(Vector3.UNIT_Y, closeEnoughToUp)) { // 3 degrees
//Detach();
return;
}
// stop it spinning
kart.Body.AngularVelocity = Vector3.ZERO;
// update its rotation to point upwards
var quat = kart.ActualOrientation;
// make the x and z factors smaller, so that all that's left at the end is the Y pointing upwards
quat.x *= 0.92f;
quat.z *= 0.92f;
quat.Normalise();
// then update the body's transform
kart.Body.SetOrientation(quat);
}
示例3: Update
public override void Update(FrameEvent evt)
{
Animate(evt);
//Here goes the collision detection with the player
// (ignore until week 8) ...
base.Update(evt);
}
示例4: FrameStarted
bool FrameStarted(FrameEvent evt)
{
if (PhysicsMain.DrawLines) {
MogreDebugDrawer.Singleton.Build();
}
return true;
}
示例5: ExampleApp_FrameStarted
protected override bool ExampleApp_FrameStarted(FrameEvent evt)
{
// Rotate fountains
mFountainNode.Yaw(evt.timeSinceLastFrame * 30);
// Call default
return base.ExampleApp_FrameStarted(evt);
}
示例6: Skeletal_FrameStarted
bool Skeletal_FrameStarted(FrameEvent evt)
{
for (int i = 0; i < NUM_ROBOTS; ++i)
{
_animState[i].AddTime(evt.timeSinceLastFrame * _animationSpeed[i]);
}
return true;
}
示例7: Update
public virtual void Update(FrameEvent frameEvent)
{
//if (State.MainWindow.RenderWindowFocused == false) return;
State.InputManger.Capture();
Rotate(YawAngle(), PitchAngle());
Translate(GetTranslation() * frameEvent.timeSinceLastFrame);
}
示例8: Update
public virtual void Update(FrameEvent evt)
{
// Projectile collision detection goes here
// (ignore until week 8) ...
if (!remove && time.Milliseconds > maxTime)
{
Dispose();
remove = true;
}
}
示例9: UpdateCamera
protected override bool UpdateCamera(FrameEvent evt)
{
base.UpdateCamera(evt);
Vector3 displacement = CameraNode._getDerivedPosition() - TargetNode.Position;
TargetNode.Orientation = CameraNode.Orientation;
TargetNode.Translate(displacement * _cameraTightness * evt.timeSinceLastFrame);
return true;
}
示例10: ExampleApp_FrameStarted
protected override bool ExampleApp_FrameStarted(FrameEvent evt)
{
if(base.ExampleApp_FrameStarted(evt) == false )
return false;
// Rotate fountains
mFountainNode.Yaw(new Degree(evt.timeSinceLastFrame * 30));
// Call default
return true;
}
示例11: ExampleApp_FrameStarted
protected override bool ExampleApp_FrameStarted(FrameEvent evt)
{
if(base.ExampleApp_FrameStarted(evt) == false )
return false;
foreach (AnimationState ani in this.mAnimStateList)
{
ani.AddTime(evt.timeSinceLastFrame);
}
return true;
}
示例12: Update
public override void Update(FrameEvent frameEvent)
{
if (!State.MainWindow.IsRenderWindowFocused) return;
State.InputManger.Capture();
bool leftButtonDown = State.InputManger.MouseState.ButtonDown(MouseButtonID.MB_Left);
bool rightButtonDown = State.InputManger.MouseState.ButtonDown(MouseButtonID.MB_Right);
bool ctrl = State.InputManger.InputKeyboard.IsKeyDown(KeyCode.KC_LCONTROL);
bool shift = State.InputManger.InputKeyboard.IsKeyDown(KeyCode.KC_LSHIFT);
bool alt = State.InputManger.InputKeyboard.IsKeyDown(KeyCode.KC_LMENU);
Vector3 amount = GetTranslation()*frameEvent.timeSinceLastFrame;
if (ctrl && shift)
{
State.SelectedNode.Rotate(amount.x/5.0f, amount.z/5.0f);
State.SelectedNode.Rotate(5.0f*YawAngle(), 5.0f*PitchAngle());
//State.SelectedNode.MoveForward(amount);
}
else if (ctrl)
{
State.SelectedNode.Translate(amount);
State.SelectedNode.Translate(10.0f*new Vector3(-YawAngle().ValueRadians, 0, PitchAngle().ValueRadians));
}
else if (shift)
{
State.SelectedNode.Translate(new Vector3(amount.x, amount.z, amount.y));
State.SelectedNode.Translate(10.0f*new Vector3(-YawAngle().ValueRadians, -PitchAngle().ValueRadians, 0));
}
else if (alt)
{
State.SelectedNode.Scale = 1 + amount.z/2;
State.SelectedNode.Scale = 1 + 2*PitchAngle().ValueRadians;
}
else if (leftButtonDown)
{
Translate(amount);
Rotate(YawAngle(), PitchAngle());
}
else
{
Translate(amount);
}
//Joystick rotation
if (State.InputManger.InputJoyStick != null)
Rotate(RotateJoystickAxis(3, true), RotateJoystickAxis(2, true));
//base.Update(frameEvent);
State.MainWindow.UpdatePropertyTreeGrid();
}
示例13: FrameStarted
/// <summary>
/// Apply a force every frame (can probably reduce this) to the player
/// </summary>
bool FrameStarted(FrameEvent evt)
{
// if someone is typing something into a text box, we don't want to move around!
if (LKernel.Get<InputSwallowerManager>().IsSwallowed())
return true;
var player = LKernel.Get<PlayerManager>().MainPlayer;
if (player != null) {
player.Actor.AddForceAtLocalPos(keyboardHandler.MovementVector * player.Kart.MoveSpeed, Vector3.ZERO);
}
return true;
}
示例14: FrameStarted
/// <summary>
/// update all of our animations, but only if we aren't paused
/// </summary>
bool FrameStarted(FrameEvent evt)
{
if (!Pauser.IsPaused) {
foreach (AnimationBlender b in blenders) {
if (!b.Source.HasEnded)
b.AddTime(evt.timeSinceLastFrame);
}
foreach (AnimationState state in states) {
if (!state.HasEnded)
state.AddTime(evt.timeSinceLastFrame);
}
}
return true;
}
示例15: ExampleApp_FrameStarted
protected override bool ExampleApp_FrameStarted(FrameEvent evt)
{
// Change curvature / tiling
// Delay timer to stop too quick updates of curvature
float timeDelay = 0;
bool updateSky;
updateSky = false;
if(!base.ExampleApp_FrameStarted(evt))
return false;
if (inputKeyboard.IsKeyDown(MOIS.KeyCode.KC_H) && timeDelay <= 0)
{
mCurvature += 1;
timeDelay = 0.1f;
updateSky = true;
}
if (inputKeyboard.IsKeyDown(MOIS.KeyCode.KC_G) && timeDelay <= 0)
{
mCurvature -= 1;
timeDelay = 0.1f;
updateSky = true;
}
if (inputKeyboard.IsKeyDown(MOIS.KeyCode.KC_U) && timeDelay <= 0)
{
mTiling += 1;
timeDelay = 0.1f;
updateSky = true;
}
if (inputKeyboard.IsKeyDown(MOIS.KeyCode.KC_Y) && timeDelay <= 0)
{
mTiling -= 1;
timeDelay = 0.1f;
updateSky = true;
}
if (timeDelay > 0)
timeDelay -= evt.timeSinceLastFrame;
if (updateSky)
{
sceneMgr.SetSkyDome(true, "Examples/CloudySky", mCurvature, mTiling);
}
return true;
}