 _LOADED["level/core/beach/common_elements.lua"] = nil;
require("level/core/beach/common_elements.lua");

-- Style overrides
------------------------------------
SetDefaultStyle(BeachStyle);

BeachConventionGeekBasicStyle.service = {{"BeachIceCreamDrag", "BeachOrangeJuiceDrag"}, {"BeachDeciding"}, {"BeachSuntan"}};

MakeState{
	type="StateCoreLevel",
	levelId = 1,

	--beginComic = "level/story/beach/1",
	
	-- Customer Factory
	customerFactory = {

		locations = {
			{ x = -60, y = 192 },
		},

		customers = {
			{
				name = {"BeachOldTimerFemaleBasic"},
				nextWave = 10,
			},

			{
				name = {"BeachConventionGeekBasic"},
				nextWave = 10,
			},
			{
				name = {"BeachOldTimerMaleBasic"},
				nextWave = 10,
			},
			{
				name = {"BeachFemale1Basic"},
				nextWave = 10,
			},
			{
				name = {"BeachOldTimerMaleBasic","BeachOldTimerMaleBasic"},
				nextWave = 13,
			},
			{
				name = {"BeachConventionGeekBasic","BeachConventionGeekBasic"},
				nextWave = 13,
			},	
			{
				name = {"BeachFemale1Basic","BeachFemale1Basic"},
				nextWave = 11,
			},
			{
				name = {"BeachOldTimerFemaleBasic","BeachOldTimerFemaleBasic"},
				nextWave = 11,
			},
			
			-- Spawnable customers
			--[[
				-- Basic customers
				-- Append 'Basic' to name before all dispensers are available
				-----------------------------------
				BeachOldTimerFemale						-- OJ, Windsurf
				BeachFemale1							-- Suntan, Bike
				BeachOldTimerMale						-- Ice Cream, Fishing
				BeachSpringBreakGirl					-- Wildcard, Wildcard
				
				-- Advanced customers
				-----------------------------------
				BeachConventionGeek						-- Wildcard, Suntan
				
				BeachNewlywedMale						-- Ice Cream or Cooking, Fishing
				BeachNewlywedFemale						-- OJ or Suntan, Windsurf
				
				BeachJapaneseExecutive					-- Cooking, Combination, Windsurf
				BeachTexasTycoon						-- Combination, Cooking, Wildcard
				
				BeachFemale2							-- Suntan, Cooking or Combination, Bike
				BeachShark								-- Suntan, Cooking or Combination, Fishing or Windsurf
			]]
		},
	},

	targetMoney = 240,
	parTime = 210000,
	targetStars = 60,
	goals = {
		
		-- Level quota. Must match targetMoney above
		--------------------------------------------------------		
		{
			type = kClosingTimeWin,
			description = GetString("Goal_ClosingTime", "240"),
			quantity = 1,
			icon = goalIconsTable[kClosingTimeWin],
		},
		
		-- Par Time. Must match parTime above
		--------------------------------------------------------
		{
			type = kEndLevelInLessThan,
			description = GetString("Goal_CompleteBefore", "3:30"),
			quantity = 1,
			condition = 210000,
			optional = true,
			group = kGoalLessThan,
			icon = goalIconsTable[kEndLevelInLessThan],
		},
		
		-- Quality Stars. Must match targetStars above
		--------------------------------------------------------
		{
			type = kHaveStars,
			description = GetString("Goal_Stars", "60"),
			quantity = 1,
			condition = 60,
			optional = true,
			icon = goalIconsTable[kHaveStars],
		},
		
		-- Losing condition. Must match targetMoney above
		--------------------------------------------------------
		{
			type = kClosingTimeLose,
			description = GetString("Goal_ClosingTime", "240"),
			quantity = 1,
			loosingCondition = true,
			icon = goalIconsTable[kClosingTimeLose],
		},
		
	},
	
	tutorialManager = {
		firstStep = 0,
		lastStep = 19,
		boxImage = "level/core/common/textures/tutorial_back",
		boxBorder = 40,
		arrowAnim = TutorialArrowAnim,
		arrowImage = "level/core/common/textures/arrow",

		font = {
			secondaryFont,
			18,
			Color(0, 0, 0, 255),
		},

		steps = {
			[0] = {
				message = "Tut_Beach_1_1",
				messagePosition = {x = 600, y = 280},
				enableStations = {"*"},
				enableEmployees = false,
				waitTime = 2000,
				triggers = {
					[kWaitTimeFinished] = 1,
					[kSkippedStep] = 1,
				},
			},
			[1] = {
				customerList = {"BeachOldTimerFemaleTutorialServe"},
				triggers = {
					[kCustomerArrived] = 2,
				},
			},
			[2] = {
				message = "Tut_Beach_1_2",
				messagePosition = {x = 600, y = 280},
				arrowPos = {
					{x = 284, y = 64},
					{x = 248, y = 256},
					{x = 344, y = 256},
					{x = 440, y = 256},
				},
				
				enableStations = {"chair1", "chair2", "chair3"},
				triggers = {
					[kRentDropCustomerRight] = 3,
				},
			},		
			[3] = {
				message = "Tut_Beach_1_3",
				messagePosition = {x = 600, y = 280},
				arrowPos = {
					{x = 592, y = 16},
				},
				enableStations = {"orangejuice"},
				triggers = {
					[kDispenserClicked] = 4,
				},
			},		
			[4] = {
				message = "Tut_Beach_1_4",
				messagePosition = {x = 600, y = 280},
				arrowPos = {
					{x = 248, y = 256},
					{x = 344, y = 256},
					{x = 440, y = 256},
				},
				enableStations = {"chair1", "chair2", "chair3"},
				triggers = {
					[kServiceClicked] = 8,
				},
			},
			[8] = {
				message = "Tut_Beach_1_5",
				messagePosition = {x = 600, y = 280},
				enableStations = {"*"},
				waitTime = 5000,
				triggers = {
					[kEmployeeArriveRestPoint] = 9,
				},
			},
			
			[9] = {
				message = "Tut_Beach_1_6",
				messagePosition = {x = 600, y = 280},
				waitTime = 5000,
				stopDance = true,
				arrowPos = {
					{x = 248, y = 256},
					{x = 344, y = 256},
					{x = 440, y = 256},
				},
				enableStations = {"chair1", "chair2", "chair3"},
				triggers = {
					[kWaitTimeFinished] = 10,
					[kSkippedStep] = 10,
					[kServiceClicked] = 11,
				},
			},
			[10] = {
				message = "Tut_Beach_1_7",
				messagePosition = {x = 600, y = 280},
				arrowPos = {
					{x = 248, y = 256},
					{x = 344, y = 256},
					{x = 440, y = 256},
				},
				enableStations = {"chair1", "chair2", "chair3"},
				triggers = {
					[kServiceClicked] = 11,
				},
			},
			[11] = {
				message = " ",
				enableStations = {"*"},
				triggers = {
					[kServiceCleaned] = 12,
				},
			},
			[12] = {
				message = "Tut_Beach_1_8",
				messagePosition = {x = 600, y = 280},
				waitTime = 4000,
				triggers = {
					[kWaitTimeFinished] = 13,
					[kSkippedStep] = 13,
				},
			},
			
			[13] = {
				message = "Tut_Beach_1_9",
				messagePosition = {x = 120, y = 160},
				waitTime = 100,
				triggers = {
					[kWaitTimeFinished] = 14,
					[kSkippedStep] = 14,
				},
			},
			[14] = {
				customerList = {"BeachOldTimerFemaleTutorialDrag", "BeachFemale1TutorialDrag", "BeachOldTimerMaleTutorialDrag"},
				triggers = {
					[kCustomerArrived] = 15,
				},
			},
			
			[15] = {
				message = "Tut_Beach_1_10",
				messagePosition = {x = 120, y = 160},
				arrowPos = {
					{x = 688, y = 216},
					{x = 746, y = 216},
					{x = 800, y = 216},
				},
				triggers = {
					[kDropCustomerRight] = 16,
					[kDropCustomerWrong] = 16,
				},
			},
			
			[16] = {
				message = "Tut_Beach_1_11",
				messagePosition = {x = 120, y = 160},
				arrowPos = {
					{x = 746, y = 216},
					{x = 800, y = 216},
				},
				triggers = {
					[kDropCustomerRight] = 17,
					[kDropCustomerWrong] = 17,
				},
			},
			
			[17] = {
				message = "Tut_Beach_1_12",
				messagePosition = {x = 120, y = 160},
				arrowPos = {
					{x = 800, y = 216},
				},
				triggers = {
					[kDropCustomerRight] = 18,
					[kDropCustomerWrong] = 18,
				},
			},
			
			-- players leave the pool
			[18] = {
				--stopDance = true,
				message = "Tut_Beach_1_13",
				waitTime = 5000,
				messagePosition = {x = 120, y = 160},
				triggers = {
					[kWaitTimeFinished] = 19,
					[kSkippedStep] = 19,
				},
			},
			-- tutorial ends
			[19] = {
				stopDance = true,
				enableStations = {"icecream", "orangejuice", "suntan", "chair1", "chair2", "chair3", "garbage", "drums"},
				enableEmployees = true,
				activeMoney = 900000,
				resumeGame = true,
				endTutorial = true,
			},
			
		},
	},

	-------------------------------------------------------------------------
	-- Graphic content

	CreateBackground();

	BlgContainer {
		name = "gameLayer",
		enableZSorting = true,

		CreateStations(0);

		-- Create all decorations
		CreateDecos();

		-- Create all decorations based on time of day
		CreateTimedDecos(2);
	},

	CreateBaseLevelControls(),
};

SetDefaultStyle(nil);