Sha256: d0800960ee7376f5b634b927dcc2ccf8a001f2e4a83a4dc1b98c0dd61c7b1121

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

using System;
using System.Collections.Generic;

namespace ClrModels {
	public class ExposingWarrior : IExposingWarrior{
      private readonly int _id;

      public string Name { get; set; }
      public int Id { get { return _id; } }

      public int Attack(IWarrior target, IWeapon weapon){
          return weapon.Attack(target);
      }

      public bool IsKilledBy(IWeapon weapon)
      {
          return weapon.Damage() > 3;
      }

      public virtual event EventHandler<EventArgs> OnIsExposedChanged;
      public bool IsExposed {get; set; }


      public event EventHandler<EventArgs> OnIsAliveChanged;

      public void Die(){
          OnIsAliveChanged(this, EventArgs.Empty);
      }

      public static event EventHandler<EventArgs> OnCountChanged;

      public static void ChangeCount(){
          OnCountChanged(null, EventArgs.Empty);
      }


      public void SomeMethod(){}
      public void OwnMethod(){

      }

      private int _life = 10;
      public int SurviveAttackWith(IWeapon weapon){
          return _life - weapon.Damage();
      }

      public void Explode(){
          IsExposed = !IsExposed;
          var handler = OnIsExposedChanged;
          if(handler != null){
              handler(this, EventArgs.Empty);
          }
      }

      public bool HasEventSubscriptions{ get { return OnIsExposedChanged != null; } }
  }
  
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caricature-0.7.7 spec/fixtures/ExposingWarrior.cs
caricature-0.7.6 spec/fixtures/ExposingWarrior.cs