var mapPolaroidValue = { tag: "mapPolaroidValue", components: [
	{
		c: TransformComponent,
		d: {
			x: 100,
			y: -80,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "$5.000",
			align: TextAlign.right,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 1 / 3,
				tint: 0xe0b86c
			}
		}
	},
]};

var mapPolaroidPrice = { tag: "mapPolaroidPrice", components: [
	{
		c: TransformComponent,
		d: {
			x: 100,
			y: 80,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "",
			align: TextAlign.right,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 1 / 3,
				tint: 0xe0b86c
			}
		}
	},
]};


var mapPolaroidValueDisabled = { tag: "mapPolaroidValue", components: [
	{
		c: TransformComponent,
		d: {
			x: 100 / 128,
			y: 80 / 128,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "$5.000",
			align: TextAlign.right,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "fontGreasyStroke",
				scale: 1 / 3,
				tint: 0x888888,
			}
		}
	},
]};

var mapPolaroidPriceDisabled = { tag: "mapPolaroidPrice", components: [
	{
		c: TransformComponent,
		d: {
			x: 100 / 128,
			y: -80 / 128,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "",
			align: TextAlign.right,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "fontGreasyStroke",
				scale: 1 / 3,
				tint: 0x888888,
			}
		}
	},
]};



var mapPolaroidPhotoContainer = { tag: "mapPolaroidPhoto", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			zIndex: -1
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_UI,
			sheet: "ui_map",
			name: "photo-filler",
		}
	},
]};

var mapPolaroidPhotoContainerDisabled = { tag: "mapPolaroidPhoto", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			zIndex: -1
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "photo-filler",
			tint: 0x888888,
		}
	},
]};

var mapPolaroidName = { tag: "mapPolaroidName", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 120,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "Minimart",
			align: TextAlign.center,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 1 / 3,
				tint: 0xe0b86c
			}
		}
	},
]};

var mapPolaroidNameDisabled = { tag: "mapPolaroidName", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: -120 / 128,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "Minimart",
			align: TextAlign.center,
			spacing: -2,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "fontGreasyStroke",
				scale: 1 / 3,
				tint: 0x888888,
			}
		}
	},
]};

var mapPolaroidLock = { tag: "mapPolaroidLock", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: -30 / 128,
			zIndex: 20,
			scaleX: 2,
			scaleY: 2,
			ignoreParentRotation: true

		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "ingame-ui",
			name: "ui-base-icon-lock-closed",
		}
	},
]};

var mapPolaroid = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 120,
			zIndex: 2,
			rotation: 0,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_UI,
			sheet: "ui_map",
			name: "polaroid",
		}
	},
], children: [
	mapPolaroidPhotoContainer,
	mapPolaroidValue,
	mapPolaroidPrice,
	mapPolaroidName
]};

var mapPolaroidDisabled = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: -120 / 128,
			zIndex: 2,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "polaroid",
			tint: 0x888888,
		}
	},
], children: [
	mapPolaroidPhotoContainerDisabled,
	mapPolaroidValueDisabled,
	mapPolaroidPriceDisabled,
	mapPolaroidNameDisabled,
]};

var completionTime = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 25,
			zIndex: 1
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "5m 21s",
			align: TextAlign.left,
			spacing: -1,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 1 / 4,
				tint: 0xe0b86c
			}
		}
	},
]};

var mapHeistTime = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 100,
			zIndex: 1
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "Average completion time:",
			align: TextAlign.left,
			spacing: -1,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 1 / 4,
			}
		}
	},
], children: [
	completionTime,
]};

var mapHeistInfo = { tag: "mapHeistInfo", components: [
	{
		c: TransformComponent,
		d: {
			x: 130,
			y: 30,
			zIndex: 1
		}
	},
], children: [
//	mapRecommendedCrew,
//	mapHeistTime
]};

var mapClickToHeist = { tag: "mapClickToHeist", components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 290,
			zIndex: 1
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "$clickStart",
			align: TextAlign.center,
			spacing: -3,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 2 / 4,
				tint: 0xe0b86c
			}
		}
	},
]};

var mapPin = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			zIndex: 10
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_UI,
			sheet: "ui_map",
			name: "pin",
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			layer: LayerDefinitions.LAYER_UI,
			allowRotation: true,
			isSensor: true,
			dynamicFriction: 0,
			density: 0.000000000001,
		}
	},
	{
		c: ClickableComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
			width: 238,
			height: 294,
			offsetY: 160,
			offsetX: 0,
		}
	},
], children: [
	mapPolaroid,
	mapHeistInfo,
	mapClickToHeist
]};

var mapPinDisabled = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			zIndex: 10,
			scaleX: 0.63,
			scaleY: 0.63,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "pin",
			scale: 1.6,
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "TransformComponent",
			field: "localRotation",
			duration: 3,
			// TransformComponent will be given random rotation in MapScene,
			// start tweening from that
			// TODO: repeats and firstValueFromTarget doesn't work correctly
			//firstValueFromTarget: true,
			values: [0.1, -0.1, 0.1],
			repeat: true
		}

	},
	{
		c: RigidBodyComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			allowRotation: true,
			isSensor: true,
			dynamicFriction: 0,
			density: 0.000000000001,
		}
	},
	{
		c: ClickableComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
			//radius: 0.25,
			width: (238 / 128) * 0.75,
			height: (264 / 128) * 0.75,
			offsetY: (-128 / 128) * 0.75,
			offsetX: 0,
		}
	},
], children: [
	mapPolaroidDisabled,
]};

var fxAshtraySmokeRising1 = { components: [
		{
			c: TransformComponent,
		},
		{
			c: TimerDestroyerComponent,
			d: {
				lifetime: 8.0
			}
		},
		{
			c: TweenerComponent,
			d: {
				component: "TransformComponent",
				field: "simpleLocalScale",
				duration: 6,
				values: [0.15, 1],
				easing: EasingFunctions.linear
			}
		},
	{
		c: RigidBodyComponent,
		d: {
		//	isBullet: true,
			density: 0.001,
		//	elasticity: 1,
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.06,
			collisionGroup: CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DOORS,
			//	CollisionCategoryDefinitions.CC_CHARACTERS,

			],
		}
	},
	], children: [
	{ components: [
		{
			c: TransformComponent,
			d: {
				zIndex: 1,
			}
		},
		{
			c: TweenerComponent,
			d: {
				component: "TransformComponent",
				field: "localRotation",
				duration: 10,
				values: [0 , -Math.PI],
				easing: EasingFunctions.linear
			}
		},
		], children: [
		{ components: [
			{
				c: TransformComponent,
				d: {
					zIndex: 1,
				}
			},
			{
				c: SpriteComponent,
				d: {
					layer: LayerDefinitions.LAYER_IN_GAME_UI,
					sheet: "fxSmoke",
					name: "fxSmokeCloud",
					loop: false,
				//	tint: 0x6bd62d,
					alpha: 0,
				}
			},
			{
				c: TweenerComponent,
				d: {
					component: "SpriteComponent",
					field: "alpha",
					duration: 1.4,
					values: [0, 0.8, 0.65, 0.5, 0.25, 0],
					repeat: false
				}
			},
		]},
	]}
]};

var fxAshtraySmokeRising2 = { components: [
		{
			c: TransformComponent,
		},
		{
			c: TimerDestroyerComponent,
			d: {
				lifetime: 8.0
			}
		},
		{
			c: TweenerComponent,
			d: {
				component: "TransformComponent",
				field: "simpleLocalScale",
				duration: 8,
				values: [0.1, 1],
				easing: EasingFunctions.linear
			}
		},
		{
		c: RigidBodyComponent,
		d: {
		//	isBullet: true,
			density: 0.001,
		//	elasticity: 1,
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.06,
			collisionGroup: CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_CHARACTERS,
			],
		}
	},
	], children: [
	{ components: [
		{
			c: TransformComponent,
			d: {
				zIndex: 1,
			}
		},
		{
			c: TweenerComponent,
			d: {
				component: "TransformComponent",
				field: "localRotation",
				duration: 15,
				values: [0 , Math.PI],
				easing: EasingFunctions.linear
			}
		},
		], children: [
		{ components: [
			{
				c: TransformComponent,
				d: {
					zIndex: 1,
				}
			},
			{
				c: SpriteComponent,
				d: {
					layer: LayerDefinitions.LAYER_IN_GAME_UI,
					sheet: "fxSmoke",
					name: "fxSmokeCloud",
					loop: false,
				//	tint: 0x6bd62d,
					alpha: 0,
				}
			},
			{
				c: TweenerComponent,
				d: {
					component: "SpriteComponent",
					field: "alpha",
					duration: 2.8,
					values: [0, 0.8, 0.6, 0],
					repeat: false
				}
			},
		]},
	]}
]};

var fxAshtraySmoke = { components: [
	{
		c: TransformComponent,
		d: {
			x: -20 / 128,
			y: -50 / 128,
		}
	},
	{
		c: SpawnerComponent,
		d: {
			entityDefinitions: ["fxAshtraySmokeRising1", "fxAshtraySmokeRising2"],
			spawnDirections: [56.25, 67.5],
			//spawnOnFirstFrame: false,
			//maxInWorld: 5,
			total: -1,
			//timeLeft: 0.01,
			minInterval: 1,
			maxInterval: 1.5,
			spawnOrder: SpawnOrder.RANDOM,
		//	initialImpulse: 0.0001,
			constantForce: 0.0002,
		}
	},
]};

var mapAshtray = { components: [
	{
		c: TransformComponent,
		d: {
			x: -444 / 128,
			y: 444 / 128,
			zIndex: -9,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "ashtray",
		//	tint: 0xd6c7b3,
			alpha: 1,
		}
	},
], children: [
	fxAshtraySmoke,
]};

var mapPostit = { components: [
	{
		c: TransformComponent,
		d: {
			x: 600 / 128,
			y: -350 / 128,
			zIndex: -8,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "postitSecret",
		//	tint: 0xd6c7b3,
			alpha: 1,
		}
	},
]};

var mapUnlockHelpPostit = { components: [
	{
		c: TransformComponent,
		d: {
			x: (650 - 750) / 128,
			y: (-680 + 500) / 128,
			zIndex: -8,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "postitHintMemo",
		//	tint: 0xd6c7b3,
			alpha: 1,
		}
	},
]};

var xMarksMinimart = { components: [
	{
		c: TransformComponent,
		d: {
			x: (650 - 750) / 128,
			y: (-480 + 500) / 128,
			zIndex: -8,
			scaleX: 2/3,
			scaleY: 2/3,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "xMarksTheSpot",
		//	tint: 0xd6c7b3,
			alpha: 1,
		}
	},
]};

var xMarksJewelryStore = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (860 - 750) / 128,
			y: (-500 + 500) / 128,
		}
	},
]};

var xMarksCentralBBBank = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (1333 - 750) / 128,
			y: (-485 + 500) / 128,
		}
	},
]};

var xMarksDiner = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (-20) / 128,
			y: (245) / 128,
		}
	},
]};

var xMarksArcade = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (50) / 128,
			y: (460) / 128,
		}
	},
]};

var xMarksWarehouse = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (-20) / 128,
			y: (690) / 128,
		}
	},
]};

var xMarksPier = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 150 / 128,
			y: 870 / 128,
			scaleX: 1,
			scaleY: 1,
		}
	},
]};

var xMarksOffice = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 770 / 128,
			y: 245 / 128,
		}
	},
]};

var xMarksPoliceStation = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 790 / 128,
			y: 500 / 128,
		}
	},
]};

var xMarksWhiteHouse = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 850 / 128,
			y: 770 / 128,
			scaleX: 1,
			scaleY: 1,
		}
	},
]};

var xMarksCasino = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 840 / 128,
			y: -70 / 128,
		}
	},
]};

var xMarksFortAccess = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 1090 / 128,
			y: -120 / 128,
		}
	},
]};

var xMarksFortKnox = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: 1300 / 128,
			y: -90 / 128,
			scaleX: 1,
			scaleY: 1,
		}
	},
]};

var xMarksHorseplay = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (910 - 750) / 128,
			y: (-760 + 500) / 128,
		}
	},
]};

var xMarksArtGallery = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (940 - 750) / 128,
			y: (-1000 + 500) / 128,
		}
	},
]};

var xMarksPoliceImpound = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (1140 - 750) / 128,
			y: (-1100 + 500) / 128,
		}
	},
]};

var xMarksSuperFly = { extend: xMarksMinimart, components: [
	{
		c: TransformComponent,
		d: {
			x: (1350 - 750) / 128,
			y: (-1120 + 500) / 128,
			scaleX: 1,
			scaleY: 1,
		}
	},
]};

var xMarksSet = { components: [
	{
		c: TransformComponent,
		d: {
		//	y: 100 / 128,
		}
	},
], children: [
	xMarksMinimart,
	xMarksJewelryStore,
	xMarksCentralBBBank,
	xMarksDiner,
	xMarksArcade,
	xMarksWarehouse,
	xMarksPier,
	xMarksHorseplay,
	xMarksArtGallery,
	xMarksPoliceImpound,
	xMarksSuperFly,
	xMarksOffice,
	xMarksPoliceStation,
	xMarksWhiteHouse,
	xMarksCasino,
	xMarksFortAccess,
	xMarksFortKnox,
]};

var mapBGBigMoney = { components: [
	{
		c: TransformComponent,
		d: {
			x: 1032 / 128,
			y: -50 / 128,
			zIndex: -9,
			scaleX: 0.91,
			scaleY: 0.91,
			rotation: 0.06,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "map-new",
			tint: 0xd6c7b3,
			alpha: 1,
		}
	},
]};

var mapBGTech = { components: [
	{
		c: TransformComponent,
		d: {
			x: 30 / 128,
			y: 665/ 128,
			zIndex: -9,
			scaleX: 0.63,
			scaleY: 0.63,
			rotation: 1.7104,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "map-new",
			tint: 0xb3c6de,
			alpha: 1,
		}
	},
]};

var mapBGDisguise = { components: [
	{
		c: TransformComponent,
		d: {
			x: 840 / 128,
			y: 650/ 128,
			zIndex: -9,
			scaleX: 0.63,
			scaleY: 0.63,
			rotation: 1.2104,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "map-new",
			tint: 0xa6a098,
			alpha: 1,
		}
	},
]};

var mapBGSnowflakes = { components: [
	{
		c: TransformComponent,
		d: {
			x: 455 / 128,
			y: -555 / 128,
			zIndex: -9,
			scaleX: 0.74,
			scaleY: 0.74,
			rotation: 0.16,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "map-new",
			tint: 0xb3c6de,
			alpha: 1,
		}
	},
]};

var mapBackground = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			zIndex: -10
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "map",
			name: "map-new",
			alpha: 1,
		}
	},
], children: [
	mapBGDisguise,
	mapBGTech,
	mapBGSnowflakes,
	mapBGBigMoney,
	mapAshtray,
	mapPostit,
	mapUnlockHelpPostit,
	xMarksSet
]};