public void Update() { IObjectLayer objectLayer = m_atlas.GetLayer(LayerType.Object) as IObjectLayer; Debug.Assert(objectLayer != null, "objectLayer != null"); // for all game objects foreach (IGameObject gameObject in objectLayer.GetGameObjects()) { List <Vector2I> coverTiles = gameObject.PhysicalEntity.CoverTiles(); // for all covering tiles of this game objects foreach (Vector2I coverTile in coverTiles) { IEnumerable <GameActorPosition> actorsAt = m_atlas.ActorsAt(new Vector2(coverTile), LayerType.TileLayers); foreach (GameActorPosition result in actorsAt) { var tileDetector = result.Actor as IDetectorTile; if (tileDetector == null) { continue; } if (tileDetector.RequiresCenterOfObject && !Atlas.Layers.Atlas.InsideTile(coverTile, gameObject.Position)) { continue; } tileDetector.ObjectDetected(gameObject, m_atlas, m_tilesetTable); } } } }
private void InitializeObjectLayer() { if (this._objectLayerType == ObjectLayerType.SessionObjectLayer) { this._unitOfWork = new UnitOfWork(this._dataLayer); this._objectLayer = new SessionObjectLayer(this._unitOfWork, true, null, null, null); } else { this._objectLayer = new SimpleObjectLayer(this._dataLayer); } }
public CollisionChecker(IAtlas atlas) { m_atlas = atlas; m_objectLayer = atlas.GetLayer(LayerType.Object) as SimpleObjectLayer; if (m_objectLayer != null) { m_physicalEntities = m_objectLayer.GetPhysicalEntities(); } else { throw new ArgumentException("ObjectLayer not found."); } }
public CollisionChecker(IAtlas atlas) { m_atlas = atlas; m_objectLayer = atlas.GetLayer(LayerType.Object) as SimpleObjectLayer; if (m_objectLayer != null) { m_physicalEntities = m_objectLayer.GetPhysicalEntities(); } else { throw new ArgumentException("ObjectLayer not found."); } }
static void Main() { ISerializableObjectLayer serializableObjectLayer = new SerializableObjectLayerServiceClient("BasicHttpBinding_ObjectLayer"); serializableObjectLayer.CanLoadCollectionObjects.ToString(); XpoDefault.DataLayer = null; XpoDefault.Session = null; ObjectLayer = new SerializableObjectLayerClient(serializableObjectLayer); using (UnitOfWork uow = new UnitOfWork(ObjectLayer)) { using (XPCollection <Customer> customers = new XPCollection <Customer>(uow)) { foreach (Customer customer in customers) { Console.WriteLine("Company Name = {0}; ContactName = {1}", customer.CompanyName, customer.ContactName); } } } Console.WriteLine("Press any key..."); Console.ReadKey(); }
public void Dispose() { if (_IDbConnection != null) { _IDbConnection.Close(); _IDbConnection.Dispose(); _IDbConnection = null; } if (_dataStore != null) { _dataStore = null; } if (_dataLayer != null) { _dataLayer.Dispose(); _dataLayer = null; } if (_unitOfWork != null) { _unitOfWork.Dispose(); _unitOfWork = null; } if (_objectLayer != null) { _objectLayer = null; } if (_session != null) { _session.Dispose(); _session = null; } GC.Collect(); }
public bool Add(GameActorPosition gameActorPosition, bool collidesWithObstacles = false) { if (collidesWithObstacles) { IObjectLayer gameObjectLayer = GetLayer(LayerType.Object) as IObjectLayer; Debug.Assert(gameObjectLayer != null, "gameObjectLayer != null"); Vector2 position = gameActorPosition.Position; GameActor actor = gameActorPosition.Actor; IPhysicalEntity physicalEntity; if (actor is IGameObject) { physicalEntity = (actor as IGameObject).PhysicalEntity; physicalEntity.Position = position; } else if (actor is Tile) { physicalEntity = (actor as Tile).GetPhysicalEntity(new Vector2I(gameActorPosition.Position)); } else { throw new ArgumentException("actor is unknown Type"); } bool anyCollision = gameObjectLayer.GetPhysicalEntities().Any(x => x.CollidesWith(physicalEntity)); if (anyCollision) { return(false); } bool anyObstacleOnPosition = GetObstaceLayers().Any(x => x.GetActorAt(new Vector2I(gameActorPosition.Position)) != null); if (anyObstacleOnPosition) { return(false); } } ILayer <GameActor> layer = GetLayer(gameActorPosition.Layer); return(layer.Add(gameActorPosition)); }
public AdventureWorks2016UnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public sistemafacturaUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
/// <summary> /// Loads map from specified path, creates tiles and objects and put them into new Atlas object. /// </summary> /// <param name="map">Deserialized .tmx file</param> /// <param name="tilesetTable">Table of numbers of game object and theirs classes</param> /// <param name="initializer"></param> /// <returns>Atlas with initial state of ToyWorld</returns> public static IAtlas LoadMap(Map map, TilesetTable tilesetTable, Action <GameActor> initializer) { IAtlas atlas = new Atlas.Layers.Atlas(); map.Tilesets = map.Tilesets.OrderBy(x => x.Firstgid).ToList(); foreach (LayerType layerType in Enum.GetValues(typeof(LayerType)).Cast <LayerType>()) { string layerName = Enum.GetName(typeof(LayerType), layerType); Debug.Assert(layerName != null); int type = (int)layerType; bool simpleType = type > 0 && (type & (type - 1)) == 0; if (!simpleType) { continue; } if (layerName.Contains("Object")) { ObjectGroup objectLayer = map.ObjectGroups.FirstOrDefault(x => x.Name == layerName); if (objectLayer == null) // TMX does not contain such layer { Log.Instance.Warn("Layer " + layerName + " not found in given .tmx file!"); continue; } IObjectLayer filledObjectLayer = FillObjectLayer( atlas, objectLayer, layerType, initializer, map.Tilesets, map.Tilewidth, map.Tileheight, map.Height ); atlas.ObjectLayers.Add( filledObjectLayer); } else { Layer tileLayer = map.Layers.FirstOrDefault(x => x.Name == layerName); if (tileLayer == null) // TMX does not contain such layer { Log.Instance.Warn("Layer " + layerName + " not found in given .tmx file!"); continue; } Random rnd = new Random(); // Shared across all layers ITileLayer filledTileLayer = FillTileLayer( tileLayer, layerType, atlas.StaticTilesContainer, tilesetTable, initializer, rnd); atlas.TileLayers.Add( filledTileLayer); } } FillNamedAreas(atlas, map); SetTileRelations(atlas, map); return(atlas); }
public UnityUnitOfWork(IObjectLayer layer, IUnityContainer unityContainer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { SetUnityContainer(unityContainer); }
public IGameObject GetObject(string name) { IObjectLayer layer = (IObjectLayer)m_atlas.GetLayer(LayerType.Object); return(layer.GetGameObject(name)); }
public OrmCookbookUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public FiwareHubUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public FirewallRulesAppUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public cds_pegasusUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public FastUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { TrackPropertiesModifications = true; }
public EndpointCheckerUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public DxSampleModelUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public TimetableUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public Vector2 WhereIsObject(string name) { IObjectLayer layer = (IObjectLayer)m_atlas.GetLayer(LayerType.Object); return(layer.GetGameObject(name).Position); }
public XpandUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }
public RapidCM_PGS_DevUnitOfWork(IObjectLayer layer, params IDisposable[] disposeOnDisconnect) : base(layer, disposeOnDisconnect) { }