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); }
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); }
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)); } }
/// <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); }
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; }
public static bool IsFake(this Essence _essence) { return(_essence is IFaked); }
public static bool Is <T>(this Essence _essence) { return(_essence != null && _essence.Is <T>()); }
public bool Equals(Essence _other) { return(GetHashCode() == _other.GetHashCode()); }
public override int GetHashCode() { return(Essence.GetHashCode()); }