public void Initialize(IWorldData worldData) { sprite = worldData.GetWorldObject(worldObjectId).GetComponent <Sprite>(); movement = worldData.GetWorldObject(worldObjectId).GetComponent <Movement>(); path = pathfinding.FindPath(sprite.TilePosition, goalTilePosition, worldData.GetComponents <ICollisionComponent>()); index = 0; IsDone = false; }
public bool CheckCollision(int xTilePosition, int yTilePosition) { var collisionObjects = worldData.GetComponents <ICollisionComponent>(); return(collisionObjects.Any(c => c.Collide(xTilePosition, yTilePosition))); }