예제 #1
0
        public Orc(MonsterState state, IMonsterBehavior hostileBehavior, IMonsterBehavior neutralBehavior)
        {
            Hitpoints    = 100;
            Name         = "Orc";
            MonsterChar  = 'O';
            IsDead       = false;
            Armor        = ArmorType.Heavy;
            Weapon       = WeaponType.Melee;
            CurrentState = state;
            Damage       = 15;


            //
            SetBehavior(MonsterState.Hostile, hostileBehavior);
            SetBehavior(MonsterState.Neutral, neutralBehavior);
        }
예제 #2
0
 public void SetBehavior(IMonsterBehavior behavior)
 {
     this.behavior = behavior ?? throw new ArgumentNullException("Invalid behavior", nameof(behavior));
 }
예제 #3
0
 public void SetBehavior(MonsterState state, IMonsterBehavior behavior)
 {
     Behaviors[state] = behavior;
 }