Using a method output in an if statement.

I am trying to get a grasp on some basics an using methods and so I came up with a scenario with some flavor text and I want to see if I am going about this in the right way.

I am trying to make it so that when input a,s,t happens different text will pop up (for now in the debug log).

Also if anyone has a better suggestion on how to do this, by all means please let me know.

Thank you, and this is my first question so if you need more info please let me know.


using UnityEngine;
using System.Collections;

public class StoryProgression : MonoBehaviour
{

public string deathText;
public string escapeText;
public string goodEscapeText;

int choiceNumber;

string[] firstChapter = {"Welcome, you must escape from the prison. Hurry! You have to get out before nightfall!",
	"You see that your in a jail, no one is around. What do you do?",
	"You made it out of your cell, however you did not notice the guard sleeping in the corner earlier. He seems to be in a deep sleep. What do you do?",
	"You are almost out of the gate at eh top of the stairs, you can see the sunlight, dusk is approaching. You hear a yell for help from a young child behind you. What do you do?"};

void Start () 
{

	deathText = "You made a bad decision, and you died.";
	escapeText = "Disreguarding the child and thinking only of yourself, you made it out of that horrid" +
		"dungeon! You travel for a week going from village to village. One day you wander into a village" +
		"and find you like the look of this happy place and decide to settle down. You marry a good looking woman " +
			"and raise a happy family on the farm. Yay!";
	goodEscapeText = "Taking the hand of the child, you burst out of the prison!...to be continued.";
	Debug.Log(firstChapter[0]);


}

void Update () 
{

	if(Input.GetKeyDown(KeyCode.Return))
	{
		Debug.Log(firstChapter[1]);

		///How would I implement my method to make the following work?
		if (choiceNumber = 1)
		{
			Debug.Log("You beat the snot out of the bars, nothing else happens, expect your knuckles are now bleeding");
		}

		if (choiceNumber = 2)
		{
			Debug.Log("You see that you are in a extreamly clean cell.");
		}

		if (choiceNumber = 3)
		{
			Debug.Log("You see a loose fist sized stone in the wall, you wiggle it out. ");
		}
	}

}

int StoryMove()
{
	if(Input.GetKeyDown(KeyCode.A))
	{
		choiceNumber = 1;
		Debug.Log("You Attack!");
		return choiceNumber;
	}

	if(Input.GetKeyDown(KeyCode.S))
	{
		choiceNumber = 2;
		Debug.Log("You use your observational skills to look anything conspicuous");
		return choiceNumber;
	}

	if(Input.GetKeyDown(KeyCode.T))
	{
		choiceNumber = 3;
		Debug.Log("You try and talk to someone");
		return choiceNumber;
	}
}

}

I guess from the text included in the code (“You Attack!” - "You beat the snot out of the bars…) that after the user selects “A”, something happens in reaction.

You need a game state for that. For now it can be a public variable.
For starters, something like:

public GameState MyGameState;

public class GameState
{
   public string Action;
   /* other fields may come here like in which room is your player */
}

Setting the GameState Action:

if(Input.GetKeyDown(KeyCode.A))
{
   MyGameState.Action = "A";
}

Evaluating user choice:

if(MyGameState.Action = "A"))
{
   /* do action */
}