public override void Update() { PreUpdate(); physicsExample.Update(); UserVars.setValue("MeshCount", physicsExample.GetElements()); PostUpdate(); }
public override void Update() { PreUpdate(); physicsExample.Update(); PostUpdate(); }
public void Update() { // Update listener //gameModel.DirectSound.UpdateListener3d(); // Manejar los inputs del teclado y joystick ManageInputs(gameModel); var sm = gameModel.SoundManager; // Condiciones de fin de partida (ademas de presionar ESC) if (!endMatch) { if (world.player1.hitPoints <= 0 || matchTime <= 0) { endMatch = true; gameOverLose = true; sm.LoadMp3(youLoseSong); sm.Mp3Player.play(false); } else if (world.enemy.hitPoints <= 0) { endMatch = true; gameOverWin = true; sm.LoadMp3(youWinSong); sm.Mp3Player.play(false); } } // Si pausado o match terminado no computo nada mas if (paused || endMatch) { return; } // Actualizar la posición y rotación de la cámara para que apunte a nuestro Player 1 camaraInterna.Target = new TGCVector3(world.player1.RigidBody.CenterOfMassPosition); var rightStick = gameModel.Input.JoystickRightStick(); float grades = 0; if (FastMath.Abs(rightStick) > 1800) { grades = ((FastMath.Abs(rightStick) - 1800f) / 81000f) * (FastMath.Abs(rightStick) / rightStick); } var angular = sma(world.player1.RigidBody.InterpolationAngularVelocity.Y) * 0.055f; camaraInterna.RotationY = world.player1.yawPitchRoll.Y + anguloCamara + halfsPI + grades - angular + (mirarHaciaAtras ? FastMath.PI : 0); // Actualizar el Vector UP si se dibuja if (drawUpVector) { //directionArrow.PStart = new TGCVector3(world.player1.RigidBody.CenterOfMassPosition); //directionArrow.PEnd = directionArrow.PStart + new TGCVector3(Vector3.TransformNormal(Vector3.UnitY, world.player1.RigidBody.InterpolationWorldTransform)) * 3.5f; var asd = Matrix.Translation(-world.player1.Mesh.BoundingBox.calculateAxisRadius().X, 0, 0) * world.player1.RigidBody.CenterOfMassTransform; directionArrow.PStart = new TGCVector3(asd.Origin); directionArrow.PEnd = new TGCVector3(asd.Origin) + TGCVector3.Up * 3.5f; directionArrow.updateValues(); } // Actualizar el mundo físico world.Update(gameModel, camaraInterna, modoCamara); // Actualizar los stats var p1 = world.player1; if (p1.turbo) { p1.specialPoints = FastMath.Max(0f, p1.specialPoints - p1.costTurbo * gameModel.ElapsedTime); } if (p1.specialPoints < p1.maxSpecialPoints) { p1.specialPoints = FastMath.Min(p1.maxSpecialPoints, p1.specialPoints + p1.specialPointsGain * gameModel.ElapsedTime); } var e = world.enemy; if (e.turbo) { e.specialPoints = FastMath.Max(0f, e.specialPoints - e.costTurbo * gameModel.ElapsedTime); } if (e.specialPoints < e.maxSpecialPoints) { e.specialPoints = FastMath.Min(p1.maxSpecialPoints, e.specialPoints + e.specialPointsGain * gameModel.ElapsedTime); } // Actualizar el tiempo matchTime -= gameModel.ElapsedTime; // Actualizar el HUD hud.Update(matchTime); }
public override void Update() { physicsExample.Update(ElapsedTime, TimeBetweenUpdates); UserVars.setValue("MeshCount", physicsExample.GetElements()); }
public override void Update() { physicsExample.Update(ElapsedTime, TimeBetweenUpdates); }