Beispiel #1
0
        public virtual void HitByProjectile(Projectile p)
        {
            Health -= p.Damage/2f;
            //AudioController.PlaySFX("hit", 0.5f, -0.4f, 0.4f, Position);
            if (p.Type == ProjectileType.Knife)
            {
                AudioController.PlaySFX("metal-hit", 0.8f, -0.2f, 0.2f, Position);
            }
            else
            {
                if (Helper.Random.Next(5) == 1)
                {
                    AudioController.PlaySFX("ricochet", 0.8f, -0.2f, 0.2f, Position);
                }
                else AudioController.PlaySFX("metal-hit", 0.8f, -0.2f, 0.2f, Position);

            }
        }
Beispiel #2
0
        public virtual void HitByProjectile(Projectile p)
        {
            if (Dead || !Active) return;

            if (drivingVehicle != null) return;

            Health -= (p.Owner.GetType() == typeof(HeroDude)) ? p.Damage : p.Damage / 2;
            AudioController.PlaySFX("hit", 0.5f, -0.4f, 0.4f, Position);
            if (p.Type != ProjectileType.Knife)
            {
                ParticleController.Instance.AddGSW(p);
            }
            else if(p.Type == ProjectileType.SMG)
            {
                ParticleController.Instance.AddSMGWound(p);
            }
            else
            {
                ParticleController.Instance.AddKnifeWound(p);
            }
            p.Active = false;
        }
Beispiel #3
0
 internal void AddSMGWound(Projectile p)
 {
     for (int i = 0; i < Helper.Random.Next(3); i++)
     {
         Vector2 dir = p.Velocity;
         float a = Helper.V2ToAngle(dir);
         a += -0.1f + ((float)Helper.Random.NextDouble() * 0.2f);
         dir = Helper.AngleToVector(a, 10f + ((float)Helper.Random.NextDouble() * 10f));
         Add(p.Position, dir, 10000f, true, new Rectangle(0, 0, 7, 7), -0.01f + ((float)Helper.Random.NextDouble() * 0.02f), 3f, Color.White, 0.5f, SpecialParticle.Blood, ParticleBlendMode.Alpha, false);
     }
 }
Beispiel #4
0
 internal void AddKnifeWound(Projectile p)
 {
     for (int i = 0; i < Helper.Random.Next(20); i++)
     {
         float a = (float)Helper.Random.NextDouble() * MathHelper.TwoPi;
         Vector2 dir = Helper.AngleToVector(a, ((float)Helper.Random.NextDouble() * 10f));
         Add(p.Position, dir, 10000f, true, new Rectangle(0, 0, 7, 7), -0.01f + ((float)Helper.Random.NextDouble() * 0.02f), 3f, Color.White, 0.5f, SpecialParticle.Blood, ParticleBlendMode.Alpha, false);
     }
 }
Beispiel #5
0
        public override void HitByProjectile(Projectile p)
        {
            base.HitByProjectile(p);

            State = AIState.Chasing;
        }
 public void Add(Vector2 spawnPos, Vector2 velocity, float life, bool canCollide, Rectangle sourcerect, float rot, float damage, Dude owner, ProjectileType type)
 {
     Projectile p = new Projectile();
     p.Type = type;
     p.Owner = owner;
     p.Damage = damage;
     p.Position = spawnPos;
     p.Velocity = velocity;
     p.Life = life;
     p.CanCollide = canCollide;
     p.SourceRect = sourcerect;
     p.Active = true;
     //p.RotationSpeed = rot;
     p.Rotation = rot;
     Projectiles.Add(p);
 }