Exemplo n.º 1
0
 public void CollisionWith(ICollider other)
 {
     if (other.Active() && other.ID() != tank.id && other.Name() == "Tank" && tank.AIControlled == true)
     {
         // tank.aiMode = Tank.AImode.PERSUIT;
         EnemyPosition = other.Position();
     }
 }
Exemplo n.º 2
0
 public void CollisionWith(ICollider other)
 {
     if (other.ID() != ownerId && other.Name() == "Tank")
     {
         //Console.WriteLine("projectile colided with a tank");
         exists = false;
     }
 }
Exemplo n.º 3
0
        public bool Active() => alive;                                        //Tells others that it's alive

        public void CollisionWith(ICollider other)                            //THIS IS WHAT THE TANK DOES WHEN IT COLIDES WITH SOMETHING
        {
            if (other.Active() && other.Name() == "Tank" && other.ID() != id) //IN CASE THE OTHER IS A TANK
            {
                Tankcoliding = true;
                Vector3 otherDirection = position - other.Position(); //Direction from which the other object is coming from
                otherDirection.Normalize();
                blockingDirection = otherDirection;
            }

            if (other.Name() == "Projectile" && other.ID() != id) //IN CASE ITS A PROJECTILE
            {
                Hit = true;
                int damage;
                //damage = 10 * (game.rng.Next(4,6));
                damage  = 50;
                Health -= damage;
                if (Health <= 0)
                {
                    alive = false;              //DIES
                }
            }
        }