コード例 #1
0
        private static void CreateCommand(BlobDatabase database, string[] tokens)
        {
            var name = tokens[1];
            var health = int.Parse(tokens[2]);
            var damage = int.Parse(tokens[3]);
            var behaviourType = tokens[4];
            var attackType = tokens[5];

            var createdBlob = new Blob(name, health, damage,
                behaviourType == "Aggressive" ? (IBehavior) new AggressiveBehavior() : new InflatedBehavior(),
                attackType == "PutridFart" ? (IAttack) new PutridFart() : new Blobplode());

            database.Add(createdBlob);
        }
コード例 #2
0
ファイル: Blob.cs プロジェクト: HouseBreaker/SoftUni-Exams
 public void Attack(Blob targetBlob)
 {
     if (IsAlive && targetBlob.IsAlive)
     {
         BlobAttack.Attack(this, targetBlob);
         if (this.BlobBehavior is AggressiveBehavior && targetBlob.Health <= targetBlob.InitialHealth)
         {
             this.BlobBehavior.Trigger(this);
         }
     }
 }
コード例 #3
0
 public abstract void ProduceAttackDamage(Blob blob);