Question by
thecrapture · Mar 23, 2016 at 01:27 AM ·
member
already defined member with same parameter types. Line 67 What am I doing wrong
using UnityEngine; using UnityEngine.UI; using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
private enum States {cell, mirror, lock_0, sheets_0, cell_mirror, sheets_1, lock_1, freedom};
private States myState;
// Use this for initialization
void Start () {
myState = States.cell;
}
// Update is called once per frame
void Update()
{
print(myState);
if (myState == States.cell)
{
state_cell();
}
else if (myState == States.sheets_0)
{
state_sheets_0();
}
else if (myState == States.lock_0)
{
state_lock_0();
}
else if (myState == States.mirror)
{
} state_mirror();
}
void state_cell () {
text.text = "You are in a prison cell, and you want to escape. There are " +
"some dirty sheets on the bed, a mirror on the wall and the door " +
"is locked from the outside.\n\n" +
"Press S to View sheets, M to view the Mirror, or L to view the lock" ;
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.sheets_0;
}
if (Input.GetKeyDown(KeyCode.L)){
myState = States.lock_0;
}
}
void state_sheets_0 (){
text.text = "You can't believe you sleep in these things. Surley it's " +
"time somebody changed them. The pleasures of prison life " +
"I guess!\n\n" +
"Press R to Return to roaming your cell";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell;
}
}
void state_lock_0()
{
text.text = "It's locked from the outside, doesn't look like there's anyway to pick it " +
"If I could get my hands on a key that would help \n\n" +
"Press R to Return to roaming your cell";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell;
}
}
void state_mirror()
{
text.text = "Just a dirty old mirror, looks like you could take it off the wall though\n\n " +
"Press T to take the mirror, press R to return to the cell.";
if (Input.GetKeyDown(KeyCode.R))
if (Input.GetKeyDown(KeyCode.T))
{
myState = States.cell;
}
}
}
Comment
I copied your code and it compiled fine. And you might want to check your
else if (myState == States.mirror)
{
} state_mirror();
Your answer
![](https://koobas.hobune.stream/wayback/20220612072942im_/https://answers.unity.com/themes/thub/images/avi.jpg)