public void OnColisionsOccours(Object sender, CollisionEventArgs args) { #region colisão do heroi com carro inimigo if (args.ColliderA is IEnemy && args.ColliderB is Heroi) { ((Heroi)args.ColliderB).EnemyCollide( (Enemy)args.ColliderA, map ); return; } if (args.ColliderB is IEnemy && args.ColliderA is Heroi) { ((Heroi)args.ColliderA).EnemyCollide( (Enemy)args.ColliderB, map ); return; } #endregion #region colisão entre os inimigos //colisão entre os inimigos if (args.ColliderA is Enemy && args.ColliderB is Enemy) { enemies.EnemyInterCollision((Enemy)args.ColliderA, (Enemy)args.ColliderB); return; } #endregion }
private void Collider_Collided(CollisionEventArgs e) { //System.Threading.Tasks.Task.Run(() => //{ // //System.Threading.Thread.Sleep(100); // //Program.MainWindow.RefreshTimer.Enabled = false; //}); }
private void Monster_Collided(CollisionEventArgs e) { // Game over if (e.CollidingObject.ToString().Equals("player")) { //System.Windows.Forms.MessageBox.Show("Game Over"); } if (e.CollidingObject.ToString().Equals("bullet")) { Task.Run(() => AudioController.PlayMonsterDieSound()); } }
private void BulletCollider_Collided(CollisionEventArgs e) { if (e.CollidingObject.ToString() == "player") return; // Check the colliding object, and do the bullet's reactions //if (e.CollidingObject is Monster) // System.Diagnostics.Debug.WriteLine("Collided with a monster"); System.Diagnostics.Debug.WriteLine("Collision detected from bullet to " + e.CollidingObject.GetType().ToString()); bulletAni.Collider.ColliderActive = false; // Setting the usage of bullet to false bulletAni.Visible = false; }
private void NotifyCollisionSolve(CollisionEventArgs args) { this.gameobj.IterateComponents<ICmpCollisionListener>( l => l.OnCollisionSolve(this, args), l => (l as Component).Active); }
void OnCollided(object sender, CollisionEventArgs e) { if (e.Other.IgnoresPhysicsLogics) { return; } RaySegmentIntersectionInfo info = e.CustomCollisionInfo as RaySegmentIntersectionInfo; if (info != null) { ReadOnlyCollection<Scalar> distances = info.Distances; for (int index = 0; index < next.Length; ++index) { RaySegmentsCollisionInfo cinfo = next[index]; if (distances[index] != -1 && (cinfo.distance == -1 || distances[index] < cinfo.distance)) { cinfo.body = e.Other; cinfo.distance = distances[index]; } } } }
private void NotifyCollisionSolve(CollisionEventArgs args) { foreach (ICmpCollisionListener c in this.gameobj.GetComponents<ICmpCollisionListener>()) { if (!(c as Component).Active) continue; c.OnCollisionSolve(this, args); } }
private void OnCollision(object sender, CollisionEventArgs args) { if (args.Object1 != null && args.Object2 != null) { if (CollisionBetween(args.Object1, args.Object2, "paddle", "stones")) { currentScore++; } else if (CollisionBetween(args.Object1, args.Object2, "stones", "persons")) { bloodLevel.Raise(); } if (args.Object2.GroupName == "target_coll") currentRescuedScore++; } }
private void collisionSystem_Collision(object sender, CollisionEventArgs e) { if (GameObject.HasComponent<ExplodableComponent>(e.Object1) && ExplodesWith(e.Object1, e.Object2)) CreateParticles(e.Object1); if (GameObject.HasComponent<ExplodableComponent>(e.Object2) && ExplodesWith(e.Object2, e.Object1)) CreateParticles(e.Object2); }
private void ProjectileAlpha_Collided(CollisionEventArgs e) { // TODO collision check for monster and remove it //if (e.CollidingObject is Monster) //AudioController.(); }
void OnCollided(object sender, CollisionEventArgs e) { if (e.Other.IgnoresPhysicsLogics|| Scalar.IsPositiveInfinity(e.Other.Mass.Mass)) { return; } IExplosionAffectable affectable = e.Other.Shape as IExplosionAffectable; if (affectable != null) { Wrapper wrapper = new Wrapper(); wrapper.body = e.Other; wrapper.affectable = affectable; items.Add(wrapper); } }
void Collider_OnCollisionLeave(object sender, CollisionEventArgs result) { Console.WriteLine("Player @Leave with " + result.CollidingObject); }
void ICmpCollisionListener.OnCollisionSolve(Component sender, CollisionEventArgs args) { }