コード例 #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
ファイル: Essence.cs プロジェクト: Foxbow74/my-busycator
 public bool Equals(Essence _other)
 {
     return(GetHashCode() == _other.GetHashCode());
 }
コード例 #9
0
 public override int GetHashCode()
 {
     return(Essence.GetHashCode());
 }