internal void Update() { if (GlobalVariables._Dead) { return; } _Physics.ApplyPhysics(_Bird); foreach (var asset in _AssetList) { _Physics.ApplyPhysics(asset); bool hit = _Physics.CheckCollision(_Bird, asset); if (hit) { GlobalVariables._Dead = true; } } PipeUpdate(); }
public void TestApplyPhysics_ActorNotAffectedByGravity() { DummyActor actor = new DummyActor() { IsAffectedByGravity = false }; var initialPosition = actor.Position; PhysicsController.ApplyPhysics(actor); Assert.AreEqual(initialPosition, actor.Position); }
public void TestApplyPhysics_StaticActor() { DummyActor actor = new DummyActor() { IsStatic = true }; var initialPosition = actor.Position; actor.MovementSpeed = new TudoMario.Vector2(1f, -5f); PhysicsController.ApplyPhysics(actor); Assert.AreEqual(initialPosition, actor.Position); }
public void TestApplyPhysics_Gravity() { DummyActor actor = new DummyActor() { IsCollisionEnabled = false }; actor.MovementSpeed.Y = 1f; var initialSpeed = actor.MovementSpeed.Y; PhysicsController.ApplyPhysics(actor); Assert.IsTrue(actor.MovementSpeed.Y < initialSpeed); actor.MovementSpeed.Y = -1f; initialSpeed = actor.MovementSpeed.Y; PhysicsController.ApplyPhysics(actor); Assert.IsTrue(actor.MovementSpeed.Y < initialSpeed); }
public void TestApplyPhysics_Friction() { DummyActor actor = new DummyActor() { IsAffectedByGravity = false }; actor.MovementSpeed.X = 1f; var initialSpeed = actor.MovementSpeed.X; PhysicsController.ApplyPhysics(actor); Assert.IsTrue(Math.Abs(actor.MovementSpeed.X) < Math.Abs(initialSpeed)); actor.MovementSpeed.X = -1f; initialSpeed = actor.MovementSpeed.X; PhysicsController.ApplyPhysics(actor); Assert.IsTrue(Math.Abs(actor.MovementSpeed.X) < Math.Abs(initialSpeed)); }