public override void Collision(GameEntity target)
 {
     if (target is Player && state == MeleeBotState.Attacking)
     {
         velocity = Vector3.Zero - velocity;
         state = MeleeBotState.Idle;
         timeToGoBack = TimeSpan.FromSeconds(timeToGoBackSeconds);
         timeToPause = TimeSpan.FromSeconds(timeToPauseSeconds);
         timeToCharge = TimeSpan.FromSeconds(timeToChargeSeconds);
         charging = false;
         Player p = target as Player;
         p.takeDamage(damage);
     }
     else if (target is PlayerWeapon)
     {
         target.Collision(this);
     }
     else if (target is Explosion)
     {
         target.Collision(this);
     }
     else if (target is MeleeBot)
     {
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is EnemiesAndPlayer && !(target is Player)) //your own explosions cannot hurt you
     {
         EnemiesAndPlayer ep = target as EnemiesAndPlayer;
         ep.takeDamage(damage);
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is LatchingCell)
     {
         target.Collision(this);
     }
     //base.Collision(target);
 }
 public override void Collision(GameEntity target)
 {
     if (target is EnemiesAndPlayer)
     {
         EnemiesAndPlayer ep = target as EnemiesAndPlayer;
         ep.takeDamage(damage);
         Die();
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player)
     {
         Player p = target as Player;
         p.changeWeapon((PlayerWeaponName)Enum.Parse(typeof(PlayerWeaponName), name, true));
         Die();
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player && !hitPlayerOnce)
     {
         Player p = target as Player;
         p.takeDamage(damage);
         hitPlayerOnce = true;
     }
 }
 public override void Collision(GameEntity target)
 {
     if (!(target is BotExplosion))
     {
         Die();
         Level.Add(new BotExplosion(damage, 50, 5, position, content));
         base.Collision(target);
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is EnemiesAndPlayer)
     {
         EnemiesAndPlayer ep = target as EnemiesAndPlayer;
         ep.takeDamage(damage);
         Die();
     }
     else if (target is BotMissile)
     {
         BotMissile bm = target as BotMissile;
         bm.Die(); //should missiles be shot down in one hit?
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player || target is Shield)
     {
         velocity = position - target.Position;
         velocity.Normalize();
         position += velocity;
     }
     else if (target is PlayerWeapon)
     {
         target.Collision(this);
     }
     else if (target is Explosion)
     {
         target.Collision(this);
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player)
     {
     }
     else if (target is PlayerWeapon)
     {
         target.Collision(this);
     }
     else if (target is Explosion)
     {
         target.Collision(this);
     }
     else if (target is MeleeBot)
     {
     }
 }
        public override void Collision(GameEntity target)
        {
            if (target is Player || target is Shield)
            {
                if (!latched)
                {
                    latched = true;
                    if (target is Player)
                    {
                        Player p = target as Player;
                        p.setVelocity(p.getVelocity() * .25f);
                        velocity = p.Velocity;
                        victim = p;
                    }
                    else
                    {
                        Shield s = target as Shield;
                        s.VelocityFactor = s.VelocityFactor / 4;
                        victim = s;
                    }
                }
                else
                {
                    //position = target.Position;
                    velocity = target.Velocity;
                }
            }
            else if (target is PlayerWeapon && !(target is Shield))
            {
                if (!latched)
                    target.Collision(this);
            }
            else if (target is Explosion)
            {
                target.Collision(this);
            }
            else //not player, shield, OR any other weapon. Handle physics.
            {

            }
        }
 public override void Collision(GameEntity target)
 {
     if (target is Player)
     {
         Die();
         Player p = target as Player;
         p.takeDamage();
     }
     else if (target is Missle)
     {
         target.Collision(this);
     }
     else if (target is Needle)
     {
         target.Collision(this);
     }
     else if (target is Explosion)
     {
         target.Collision(this);
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player)
     {
         Vector3 newPos = target.Position + target.Velocity;
         BoundingSphere bs = new BoundingSphere(newPos, target.sphere.Radius);
         if (bs.Intersects(this.sphere))
         {
             target.Position -= target.Velocity;
         }
     }
     else if (target is PlayerWeapon)
     {
         target.Collision(this);
     }
     else if (target is StraightCell)
     {
         target.Die();
         TimeSpan ts = TimeSpan.FromSeconds(1);
         convertingCells.Add(ts);
     }
 }
Esempio n. 14
0
 public static void Add(GameEntity newEnt)
 {
     entities.Add(newEnt);
 }
Esempio n. 15
0
 public override void Collision(GameEntity target)
 {
     base.Collision(target);
 }
Esempio n. 16
0
 public override void Collision(GameEntity target)
 {
 }
 public virtual void Collision(GameEntity target)
 {
 }
Esempio n. 18
0
 public override void Collision(GameEntity target)
 {
     if (!(target is PlayerWeapon) && !(target is Explosion))
     {
         target.Collision(this);
     }
 }
 public override void Collision(GameEntity target)
 {
     if (target is Player)
     {
         Vector3 newPos = target.Position + target.Velocity;
         BoundingSphere bs = new BoundingSphere(newPos, target.sphere.Radius);
         if (bs.Intersects(clotBox))
         {
             target.Position -= target.Velocity;
         }
     }
     else if (target is PlayerWeapon)
     {
         target.Collision(this);
     }
     else if (target is StraightCell)
     {
         if (side == Side.Left)
         {
             target.Position -= Vector3.UnitX;
         }
         else target.Position += Vector3.UnitX;
     }
     else if (target is ClotSide)
     {
         //game over
         seal = true;
     }
 }
 public void inRange(GameEntity target)
 {
     if (target is StraightCell)
     {
         StraightCell sc = target as StraightCell;
         sc.Absorb();
         Vector3 newVel = position - sc.Position;
         newVel.Normalize();
         sc.Velocity = newVel;
     }
 }