Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        private void Collider_Collided(CollisionEventArgs e)
        {
            //System.Threading.Tasks.Task.Run(() =>
            //{
            //    //System.Threading.Thread.Sleep(100);
            //    //Program.MainWindow.RefreshTimer.Enabled = false;

            //});
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 5
0
		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];
                    }
                }
            }
        }
Exemplo n.º 7
0
		private void NotifyCollisionSolve(CollisionEventArgs args)
		{
			foreach (ICmpCollisionListener c in this.gameobj.GetComponents<ICmpCollisionListener>())
			{
				if (!(c as Component).Active) continue;
				c.OnCollisionSolve(this, args);
			}
		}
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 10
0
 private void ProjectileAlpha_Collided(CollisionEventArgs e)
 {
     // TODO collision check for monster and remove it
     //if (e.CollidingObject is Monster)
     //AudioController.();
 }
Exemplo n.º 11
0
 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);
     }
 }
Exemplo n.º 12
0
 void Collider_OnCollisionLeave(object sender, CollisionEventArgs result)
 {
     Console.WriteLine("Player @Leave with " + result.CollidingObject);
 }
Exemplo n.º 13
0
 void ICmpCollisionListener.OnCollisionSolve(Component sender, CollisionEventArgs args)
 {
 }