Hello all!
I was just curious, is there a way to reference a state directly, as in by name? I have an interesting mechanic that I want to add, however it would require me to reference specific states by name that I have created.
For example, it would look like this:
int honor;
// Update is called once per frame
void Update()
{
HonorUpdate();
}
public void HonorUpdate()
{
if (currentState == "STATE NAME")
{
honor = honor + 1;
}
else if (currentState == "Other State Name")
{
honor = honor - 1;
}
else
{
//do nothing
}
}
(Although I probably wouldn’t put it in update, just have it synced with the buttons to update as it goes)
and then on the UI a bar goes up and down to show the current Honor score. Theoretically, then once you reach a certain honor score it could trigger a special ending or something (planning it out so that you would can only gain enough at the end of the story)
Is this possible? to be able to reference a State by name or number so that I can use the states as triggers? Or is there a better option to accomplish this goal?
/Jeff
edit: replaced the screenshot with a block of code.