Example #1
0
        /// <summary>
        /// Finishes the tutorial
        /// </summary>
        public void FinishTutorial()
        {
            IsFinished = true;
            
            // @TO DO Make sure we destroy all objects and clean everything up!
			ResourceManager<AudioClip>.Instance.UnLoad(ResourceEnum.AUDIOCLIP_UNCLELOUIE);
			
            ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_ICON_MORE_TEXT);            
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_0);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_1);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_2);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_3);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_4);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_5);
			ResourceManager<Texture2D>.Instance.UnLoad(ResourceEnum.TEXTURE_TUTORIAL_LOUIE_6);
	
			GUIStateManager.Instance.RemoveChild(GUIElementEnum.TutorialLouie);
			GUIStateManager.Instance.RemoveChild(GUIElementEnum.TutorialDialogueWindow);

			louieDialogueWindow.Destroy();
			louieDialogueBox.Destroy();
			louieImage.Destroy();
			moreTextButton.Destroy();
			
			louieDialogueBox = null;
			louieImage = null;
			moreTextButton = null;

			stages.Clear ();
			stages = null;
			currentStage = null;
			sayings = null;
			louieTextures.Clear ();
			louieTextures = null;
		}
Example #2
0
		/// <summary>
		/// 
		/// </summary>
        /// <param name="index"></param>
        public void SetStage(int index)
        {
            currentStageIndex = index;

			if (player != null)
			{
				if (player.TutorialStage != currentStageIndex)
				{
					player.TutorialStage = currentStageIndex;
					player.StateChanged = true;
					
					ServerCommunicator.Instance.Communicate(
						ServerActionEnum.SetTutorialStage, currentStageIndex,
						(ServerCommunication com) => 
						{						
						}, GUIGameObject.SetGlobalError);
				}
			}

            if (currentStageIndex >= stages.Count)
            {
                FinishTutorial();
                return;
            }

            currentStage = stages[currentStageIndex];
            currentStage = stages[index];                       

            if (currentStage.OnStart != null)
            {
                currentStage.OnStart();
            }            
        }
Example #3
0
        /// <summary>
        /// Initializes the tutorial manager instance
        /// </summary>
        public void Initialize(GamePlayer player)
        {
            LoadAssets();
		
			this.player = player;
            TutorialStage stage;
            GamePlayerStateCheck stateCheck = null;

			//Hey kiddo, it's your Uncle Louie, how's it going? I see the old man left you in charge of this place. You know he never did manage to make something of this place, but I have faith in you, kid.
            stage = new TutorialStage();
            stage.OnStart = () =>
            {
				AudioSource.PlayClipAtPoint(louieSound, Vector3.zero);
            	SetStageText(0, true);
            	ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Normal, true);
            };           
            stages.Add(stage);

			//Don't worry, I'll help show you the ropes, so you can build the biggest pizza empire in this city!
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(1, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised, true);
			};            
            stages.Add(stage);

			//The first thing we need to do is call the wholesaler and order some flour. You can't make pizza dough without flour, and the dough is the secret to the best tasting pizza!
            stage = new TutorialStage();            
			stage.OnStart = () =>
			{
				SetStageText(2, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};
            stages.Add(stage);
            
			//To phone the wholesaler tap on the phone icon. Tap and drag the white flour icon into your shopping cart. Tap the checkmark when you're done.
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(3, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, false);
			};
            stateCheck = new GamePlayerStateCheck();
            stateCheck.Rules.Add(
            	new WorkInProgressCompareRule 
            	{
            	  	Item = new ItemQuantity
            	  	{
    	  				ItemCode = BuildableItemEnum.White_Flour,
            	  		UnStoredQuantity = 1            	  		
            	  	},
            	  	ComparisonType = ComparisonEnum.GreaterThanOrEqual
            	});
            stage.PlayerStateCheck = stateCheck;
            stages.Add(stage);

			//You did good kid. You shouldn't have to wait too long to get your flour, the wholesaler is just around the corner. 
            stage = new TutorialStage();
            stage.OnStart = () =>
            {
				GUIItem window = GUIStateManager.Instance
					.GetChildNested(GUIElementEnum.OrderIngredientsWindow);				
				window.Visible = false;
				SetStageText(4, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Excited_Happy_Thumbs_Up, true);
            };
            stages.Add(stage);
            
			//To check how long it will be before your flour arrives, do something.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(5, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};
			stage.GUIEvent = new GUIEvent(GUIElementEnum.InGameMotorcycle, GUIEventEnum.Tap);
			stages.Add(stage);

			//Excellent! You see I told you it wouldn't be long. Just let me know when it gets here I'll help you unload it.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(6, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Excited_Happy, true);
			};
			stages.Add(stage);
			
			//In the meantime it looks like we have some cleaning up to do around here. Look at that table it's filthy! No one will want to eat on a filthy table.
            stage = new TutorialStage();
            stage.OnStart = () =>
            {
                AudioSource.PlayClipAtPoint(louieSound, Vector3.zero);
				SetStageText(7, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Eye_Pop, true);
            };
            stages.Add(stage);

			//To clean a table, tap on it and then take the cloth and wipe it.
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(8, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Negative, false);
				GameObject dirtyTable = ResourceManager<GameObject>.Instance.Load(ResourceEnum.PREFAB_DIRTY_TABLE);			
				GameObject.Instantiate(dirtyTable, new Vector3(-5f,-0.6f,0), Quaternion.identity);						
			};
			stateCheck = new GamePlayerStateCheck ();
			stateCheck.Rules.Add(
				new StorageItemUnstoredQuantityCompareRule
				{
					 Location = 0,
					 Level = 0,
					 Item = BuildableItemEnum.Dirty_Table,
					 Quantity = 1,
					 ComparisonType = ComparisonEnum.LessThan
				});
			stage.PlayerStateCheck = stateCheck;
            stages.Add(stage);

			//Good work! Tables will get dusty over time on their own and customers will also mess them up. Customers won't sit in your restaurant to be served unless the table is clean!
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(9, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};
            stages.Add(stage);

			//I hope you didn't think that that owning a pizza restaurant was going to be all fun and games? It's like my father always said "owning a pizza restaurant is not all fun and games..." 
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(10, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};
            stages.Add(stage);

			//...hmm I forgot the rest.
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(11, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};
            stages.Add(stage);

			//You need great dough to make great pizza, but the sauce is just as important! If you want to make the best sauce you're going to want fresh tomatoes. Luckily for us, there are local farmers who will deliver right to your restaurant.
            stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(12, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};         
            stages.Add(stage);

			//To order tomatoes, tap on the phone icon. Tap on the vegetables tab. Now add the tomatoes to your shopping cart like you did with the flour. When you're done tap the checkmark.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(13, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, false);
			};
			stateCheck = new GamePlayerStateCheck();
			stateCheck.Rules.Add(
				new WorkInProgressCompareRule 
				{
				Item = new ItemQuantity
				{
					ItemCode = BuildableItemEnum.Tomatoes,
					UnStoredQuantity = 1            	  		
				},
				ComparisonType = ComparisonEnum.GreaterThan
			});
			stage.PlayerStateCheck = stateCheck;
			stages.Add(stage);

			//Way to go kiddo, you're learning how to run a business! It takes a little longer to get stuff from the farm, but those tomatoes will be before you know it.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				GUIItem window = GUIStateManager.Instance
					.GetChildNested(GUIElementEnum.OrderIngredientsWindow);				
				window.Visible = false;
				SetStageText(14, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};         
			stages.Add(stage);

			//It seems you inherited another mess this time its in the kitchen. The dishes need to be cleaned if you want to serve customers. Dishes will accumulate as customers eat your pizza. You'll need to keep the dishes clean in order to keep working!
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(15, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};         
			stages.Add(stage);

			//To wash dishes, tap the dishes that have accumulated in the sink and then take the soap and scrub it over the dishes.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(16, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Negative, false);
				GameObject dirtyTable = ResourceManager<GameObject>.Instance.Load(ResourceEnum.PREFAB_DIRTY_DISHES);			
				GameObject.Instantiate(dirtyTable, new Vector3(-5f,-0.6f,0), Quaternion.identity);			
			};
			stateCheck = new GamePlayerStateCheck ();
			stateCheck.Rules.Add(
				new StorageItemUnstoredQuantityCompareRule
				{
				Location = 0,
				Level = 0,
				Item = BuildableItemEnum.Dirty_Dishes,
				Quantity = 1,
				ComparisonType = ComparisonEnum.LessThan
			});
			stage.PlayerStateCheck = stateCheck;
			stages.Add(stage);

			//Gee you're a hard worker. Keep this determination and your pizza restaurants are going to be all over this city in no time.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(17, true);
				ToggleMoreTextButton(true);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};         
			stages.Add(stage);

			//Wait for flour to arrive...
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(0, false);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, false);
			};   
			stateCheck = new GamePlayerStateCheck ();
			stateCheck.Rules.Add(
				new StorageItemUnstoredQuantityCompareRule
				{
				Location = 0,
				Level = 0,
				Item = BuildableItemEnum.White_Flour,
				Quantity = 1,
				ComparisonType = ComparisonEnum.GreaterThanOrEqual
			});
			stage.PlayerStateCheck = stateCheck;

			//Well look at that! Your flour is here. I told you it wouldn't take long. To unload the flour, tap the flour bag in the back of the delivery van and drag it into your restaurant.
			stage = new TutorialStage();
			stage.OnStart = () =>
			{
				SetStageText(18, true);
				ToggleMoreTextButton(false);
				SetLouieTexture(LouieExpression.Surprised_Arm_Raised, true);
			};         
			stages.Add(stage);

            SetStage(player.TutorialStage);
        }