Exemplo n.º 1
0
 public void Fight(_Agent opponent)
 {
     try
     {
         Attack(opponent);
         opponent.Attack(this);
     }
     catch (NullReferenceException) { }
 }
Exemplo n.º 2
0
 public void Attack(_Agent opponent)
 {
     //opponent.health -= (int)attack / 2 + (int)attack * (baseHealth / 200);
     opponent.health -= attack;
     if (opponent.health < 0)
     {
         opponent.Die();
     }
 }
Exemplo n.º 3
0
 public void RemoveEntity(_Entity entity)
 {
     if (entity is Player)
     {
         player = null;
     }
     else if (entity is _Agent)
     {
         agent = null;
     }
     else if (entity is Thing)
     {
         thing = null;
     }
     else
     {
         throw new BadEntityException("Tried to remove " + entity.ToString() + " from " + ToString());
     }
 }
Exemplo n.º 4
0
 public void AssignEntity(_Entity entity)
 {
     if (entity is Player)
     {
         player = (Player)entity;
     }
     else if (entity is _Agent)
     {
         agent = (_Agent)entity;
     }
     else if (entity is Thing)
     {
         thing = (Thing)entity;
     }
     else
     {
         throw new BadEntityException("Tried to assign " + entity.ToString() + " to " + ToString());
     }
 }