コード例 #1
0
        public override void RespondToAttack(IProjectile attack)
        {
            this.Shields += 50;

            base.RespondToAttack(attack);

            this.Shields -= 50;
        }
コード例 #2
0
        public override void RespondToAttack(IProjectile attack)
        {
            this.Shields += 50;

            attack.Hit(this);

            this.Shields -= 50;
        }
コード例 #3
0
ファイル: StarShip.cs プロジェクト: ikolev94/Exercises
 public virtual void RespondToAttack(IProjectile attack)
 {
     attack.Hit(this);
     if (this.Shields<0)
     {
         this.Shields = 0;
     }
     if (this.Health<0)
     {
         this.Health = 0;
     }
 }
コード例 #4
0
        // Responds to an attack by raising its shields by 50 before the attack and removes them after it.
        public override void RespondToAttack(IProjectile attack)
        {
            if (this.Attacked)
            {
                this.Shields += 50;
                this.Attacked = false;
            }
            else
            {
                this.Shields -= 50;
                this.Attacked = true;

            }
        }
コード例 #5
0
ファイル: Dreadnought.cs プロジェクト: peterkirilov/SoftUni-1
        public override void RespondToAttack(IProjectile attack)
        {
            this.Shields += 50;

            attack.Hit(this);

            this.Shields -= 50;

            if (this.Health <= 0)
            {
                this.Health = 0;
                Console.WriteLine(Messages.ShipDestroyed, this.Name);
            }

            if (this.Shields <= 0)
            {
                this.Shields = 0;
            }
        }
コード例 #6
0
 public virtual void RespondToAttack(IProjectile attack)
 {
     attack.Hit(this);
 }
コード例 #7
0
 public override void RespondToAttack(IProjectile attack)
 {
     this.Shields += 50;
     base.RespondToAttack(attack);//преизползваме базовия клас
     this.Shields -= 50;
 }
コード例 #8
0
ファイル: Ship.cs プロジェクト: zlatkovtv/SoftUni_OOP
 public abstract void RespondToAttack(IProjectile attack);
コード例 #9
0
ファイル: Starship.cs プロジェクト: AsenTahchiyski/SoftUni
 public virtual void RespondToAttack(IProjectile projectile)
 {
     projectile.Hit(this);
 }
コード例 #10
0
ファイル: Ship.cs プロジェクト: peterkirilov/SoftUni-1
        public virtual void RespondToAttack(IProjectile attack)
        {
            attack.Hit(this);

            if (this.Health <= 0)
            {
                this.Health = 0;
                Console.WriteLine(Messages.ShipDestroyed, this.Name);
            }

            if (this.Shields < 0)
            {
                this.Shields = 0;
            }
        }
コード例 #11
0
 public void RespondToAttack(IProjectile attack)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
ファイル: Cruiser.cs プロジェクト: ROSSFilipov/CSharp
 public override void RespondToAttack(IProjectile attack)
 {
     attack.Hit(this);
 }
コード例 #13
0
ファイル: Cruiser.cs プロジェクト: zlatkovtv/SoftUni_OOP
 public override void RespondToAttack(IProjectile attack)
 {
 }
コード例 #14
0
ファイル: Starship.cs プロジェクト: monikaBchvarova/C-Sharp
 public virtual void RespondToAttack(IProjectile attack)
 {
 }