Beispiel #1
0
 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 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 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 PlayerWeapon) && !(target is Explosion))
     {
         target.Collision(this);
     }
 }
 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 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 LatchingCell)
     {
         target.Collision(this);
     }
     //base.Collision(target);
 }
 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)
     {
     }
     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)
     {
         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 || 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 || 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)
     {
         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);
     }
 }
 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);
     }
 }
 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;
     }
 }