Ejemplo n.º 1
0
 public override void Render(WorldRenderer In)
 {
     In.PushMatrix();
     const double angleoffset = 0.6;
     const float offsetscale = 0.1f;
     float sinyaw = (float)Math.Sin(-Yaw - angleoffset);
     float cosyaw = (float)Math.Cos(-Yaw - angleoffset);
     In.Translate(_pos.X - sinyaw * offsetscale, In.Pos.Y - 0.12f, _pos.Z - cosyaw * offsetscale);
     In.Rotate(Vector3.UnitY, -Yaw);
     const float arange = (float)(Math.PI * 0.01);
     const double afreq = Math.PI * 0.01;
     float swingX = (float)(Math.PI * 0.5 * Math.Sin(Math.PI * _swingFrame / SWING_FRAMES));
     float swingZ = (float)(Math.PI * 0.5 * Math.Sin(Math.PI * _swingFrame / SWING_FRAMES));
     In.Rotate(Vector3.UnitX, arange * (float)Math.Sin(afreq * In.GetFrame() + 2 * arange) - swingX);
     In.Rotate(Vector3.UnitZ, arange * (float)Math.Cos(afreq * In.GetFrame()) + swingZ);
     _sword.Render(In);
     In.PopMatrix();
 }
Ejemplo n.º 2
0
 public override void Render(WorldRenderer WR)
 {
     WR.PushMatrix();
     WR.Translate(_pos.X, _pos.Y, _pos.Z);
     WR.PushMatrix();
     WR.Rotate(Vector3.UnitY, Yaw);
     if (_runDeath) {
         int angleFrame = (_deathAnimFrame < DEATH_ANIM_FRAMES) ? _deathAnimFrame : DEATH_ANIM_FRAMES;
         float angle = (float)(Math.PI * Math.Sin(angleFrame / (2.0 * DEATH_ANIM_FRAMES) * Math.PI) * 0.5);
         WR.Rotate(Vector3.UnitX, angle);
         ++_deathAnimFrame;
         if (_deathAnimFrame > DEATH_SHOW_TIME) {
             Dead = true;
         }
     }
     if (_hurtFrames < HURT_SHOW_FRAMES) {
         ++_hurtFrames;
         WR.SetHighlight(2);
     }
     _mdl.Render(WR);
     WR.SetHighlight(1);
     WR.PopMatrix();
     if (_runDeath) {
         WR.Translate(0, 3.5f, 0);
         WR.Rotate(Vector3.UnitX, (float)(Math.PI));
         WR.Rotate(Vector3.UnitY, WR.Yaw);
         _quote.Second.Render();
     }
     WR.PopMatrix();
 }