Beispiel #1
0
        public Bullet(int who, Vector2 pos, float rot, float dmg, DamageType type)
            : base(null, pos, false)
        {
            isSent = false;
            switch (type)
            {
            case DamageType.Normal:
                Textures.Add(Loader.LoadGameTexture("WorldObjects/Bullets/NormalBullet"));
                Damage = new Other.Damage(dmg);
                Clr    = Color.White;
                break;

            case DamageType.Poison:
                Textures.Add(Loader.LoadGameTexture("WorldObjects/Bullets/PoisonBullet"));
                Damage = new Other.Damage(dmg, 4, 1, type);
                Clr    = Color.Green;
                break;

            case DamageType.Water:
                Textures.Add(Loader.LoadGameTexture("WorldObjects/Bullets/WaterBullet"));
                Damage = new Other.Damage(dmg, 2, 5, type);
                Clr    = Color.Blue;
                break;
            }
            this.who  = who;
            _size     = new Point(Textures[0].Width, Textures[0].Height / 3);
            Direction = Config.AngleToVector(rot);
            Rotation  = rot;
            Position  = pos;
        }
Beispiel #2
0
 public void AddDamage(Other.Damage damage)
 {
     if (damage.Type != DamageType.Normal)
     {
         for (var i = _takenDamage.Count - 1; i >= 0; i--)
         {
             if (_takenDamage[i].Type == damage.Type)
             {
                 if (_takenDamage[i].CurrentTick > 0)
                 {
                     _takenDamage[i] = damage;
                 }
                 return;
             }
         }
     }
     _takenDamage.Add(damage);
 }