예제 #1
0
 public static bool IsLockedFor(this Essence _essence, LiveMapCell _cell, Creature _creature)
 {
     if (_essence == null)
     {
         return(false);
     }
     if (_essence.IsFake())
     {
         _essence = _cell.ResolveFakeThing(_creature);
     }
     return(_essence is ICanbeOpened && ((ICanbeOpened)_essence).ELockType != ELockType.OPEN);
 }
예제 #2
0
 public static bool CanBeClosed(this Essence _essence, LiveMapCell _cell, Creature _creature)
 {
     if (!(_essence is Thing))
     {
         return(false);
     }
     if (_essence.IsFake())
     {
         _essence = _cell.ResolveFakeThing(_creature);
     }
     return(_essence is ICanbeClosed && ((ICanbeClosed)_essence).ELockType == ELockType.OPEN);
 }
예제 #3
0
 private static void Add(Essence _essence)
 {
     if (_essence is Creature)
     {
         m_fakedCreatures.Add(new FakedCreature(_essence));
     }
     else
     if (_essence is Item)
     {
         m_fakedItems.Add(new FakedItem(_essence));
     }
     else
     {
         m_fakedThings.Add(new FakedThing(_essence));
     }
 }
예제 #4
0
 /// <summary>
 /// Возвращает имя объекта
 /// </summary>
 /// <param name="_essence"> </param>
 /// <param name="_creature"> </param>
 /// <returns> </returns>
 public static Noun GetName(this Essence _essence, Creature _creature)
 {
     if (_essence is IFaked)
     {
         _essence = ((IFaked)_essence).Essence;
     }
     if (_essence is Creature)
     {
         if (_essence is Intelligent)
         {
             return(_essence.Name);
         }
         return(_essence.Name);
     }
     if (_essence.Name == null)
     {
     }
     return(_essence.Name);
 }
예제 #5
0
 public EssenceDescriptor(Essence _essence, LiveMapCell _cell, IContainer _container, Creature _creature)
 {
     m_creature = _creature;
     if (_essence is IFaked)
     {
         if (_container != null)
         {
             if (_essence is Item)
             {
                 _essence = _container.ResolveFakeItem(_creature, (FakedItem)_essence);
             }
             else
             {
                 throw new NotImplementedException("Как так?");
             }
         }
         else if (_cell != null)
         {
             if (_essence is Item)
             {
                 _essence = _cell.ResolveFakeItem(_creature, (FakedItem)_essence);
             }
             else if (_essence is Thing)
             {
                 _essence = _cell.ResolveFakeThing(_creature);
             }
         }
         else
         {
             throw new NotImplementedException("Как так?");
         }
     }
     Essence    = _essence;
     LiveCoords = _cell != null?_cell.LiveCoords:null;
     Container  = _container;
 }
예제 #6
0
 public static bool IsFake(this Essence _essence)
 {
     return(_essence is IFaked);
 }
예제 #7
0
 public static bool Is <T>(this Essence _essence)
 {
     return(_essence != null && _essence.Is <T>());
 }
예제 #8
0
 public bool Equals(Essence _other)
 {
     return(GetHashCode() == _other.GetHashCode());
 }
예제 #9
0
 public override int GetHashCode()
 {
     return(Essence.GetHashCode());
 }